Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Using docValues should be the default for all string fields due to performance reasons. But there's an important edge case:
String fields are using SORTED_SET, so multiple identical entries are collapsed into a single value. Thus if I insert values 4, 5, 2, 4, 1, my return will be 1, 2, 4, 5 when enabling docValues.
If you need to preserve the order and duplicate entries, consider to store the values as zm_* (twice). Therefor select the "solr_string_storage" custom field type.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3024554.patch | 1.6 KB | mkalkbrenner |
Comments
Comment #2
mkalkbrennerComment #4
mkalkbrennerComment #6
Jancy Christopher CreditAttribution: Jancy Christopher commentedHi mkalkbrenner,
As mentioned above
Can you explain select the solr_string_storage custom field type?
Thanks for your feedback
Comment #7
Jancy Christopher CreditAttribution: Jancy Christopher commentedHi mkalkbrenner,
I Have upgraded my search Search API Solr module from 8.x-2.0-alpha2 to 8.x-3.3.
I can see there is difference in how the best bet fields are indexed.
Added in indexed field as,
field exclude - data type boolean
field query_text - data type string
On solr 8.x-2.0-alpha2 the best bet values were indexed as below.
and now the bm_exclude values does not presave the duplication and order.
It is displaying as below.
Any suggestion on the above will be good thanks.
Comment #8
mkalkbrennerYou must not use docValues in this case. You can modify the field type using the yaml file or even better provide a dedicated type for that. The best way would be if that module provides its dedicated Solr field type.
Comment #9
Jancy Christopher CreditAttribution: Jancy Christopher commented@mkalkbrenner, Thanks for your feedback.
To fix I have removed the docValues for boolean from schema.xml file.
For the string field I have changed the field type to storage-only(solr_string_storage custom field type option available in search_api_solr).
This preserves the duplication and order.