Closed (fixed)
Project:
Search API
Version:
8.x-1.x-dev
Component:
Database backend
Priority:
Normal
Category:
Bug report
Assigned:
Issue tags:
Reporter:
Created:
2 Apr 2014 at 13:16 UTC
Updated:
9 Oct 2015 at 21:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
Johnny vd Laar commentedAttached is a patch that uses strtolower. I think the search function also does this.
Comment #2
drunken monkeyThanks for reporting this issue!
You're right, I hadn't really thought about it but currently the incomplete keys aren't processed by any processors, so things like case insensitivity won't be applied to them automatically. I don't really know what the proper way to fix this would be, but I guess applying such a workaround for this module would make sense for now. While some people might have their searches set up as case-sensitive, most people probably haven't.
However, your patch isn't completely correct as you'd need to have both keys and values in
$keysin lower case, and also lowercase the incomplete key when adding that.Comment #3
drunken monkeyComment #4
valderama commentedCan't I assume that all indexed data is actually lowercase? The indexItem method from SearchApiDbService casts all textual fields to lowercase, as far as I can see.
That would make case-sensitive searches impossible with the DB server anyhow - and would allow to simply convert all user input for the autocompletion to lowercase as well.
I have a slightly different patch to #1 - but actually it simple converts input to lowercase.
Comment #5
drunken monkeyFor the moment, yes, you're right. Since we now set the table collation, at least for fulltext fields, we should maybe fix that – but in this case it's of course practical. Otherwise, I don't know – we'd maybe have to check whether the "Ignore case" processor is enabled on the index, or use all the index's processors on the incomplete key in some way. Might still be good, as it's a cleaner and broader solution, but this quick fix should already cover most cases.
Leaving this open for comments for now, and will commit in a week or so. Thanks!
Comment #6
drunken monkeyCommitted.
Thanks again!
Comment #9
drunken monkeyNeeds to be ported to D8. (Even though there is no Autocomplete module in D8 yet, the code in the DB backend is still there and we'll probably forget if we don't fix this now.)
Comment #10
drunken monkeyComment #11
dragos-dumi commentedComment #12
cristiroma commentedUploading Drupal 8 port patch.
Comment #13
drunken monkeyThanks a lot, looks good!
Also really great that you wanted to add tests, a pity it doesn't really work for this issue. But generally, very admirable!
Committed. Thanks again!
Comment #16
drunken monkey