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.
String field values are treated as is in Solr, without any processing. Unfortunately, this module uses trim() for values when search query is constructing. This means if a string field containing " value" (with leading space) is indexed, it can't be found using filters from this module.
I suggest to check field type before trimming the value to search.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2527528-2--remove_filter_value_trimming.patch | 505 bytes | drunken monkey |
#1 | search_api_solr-trim_string_value-2527528-1.patch | 587 bytes | maximpodorov |
Comments
Comment #1
maximpodorov CreditAttribution: maximpodorov commentedComment #2
drunken monkeyHuh, you're right. Actually, I'm not sure why we would ever want to trim a value there? If a value with a leading/trailing space is coming in, there's gotta be a reason for that. Also, for fulltext fields it won't matter anyways, and I think numeric values would probably get trimmed automatically.
So, actually I'd say we can just remove this line? Patch attached.
In any case, thanks a lot for reporting and providing a patch!
Comment #3
cristiroma CreditAttribution: cristiroma commentedI've just tested this the following way:
1. Attached a text field to Article
2. Added the field to the Index as string & updated the index
3. Created a solr view exposing a filter on the field
Here's the result in Solr console:
Without the patch:
With patch:
So the content is untrimmed and we have 1 hit coming from Solr
Comment #4
drunken monkeyOK, great to hear. Thanks for testing!
Committed.
Thanks again also to maximpodorov!