flexsearch
flexsearch copied to clipboard
Case-insensitive tag search?
Hi, I have a document with a bunch of tags, like {..., tags: ['cat', 'DOG']}
And I want to search case-insensitive, so both these searches will catch it:
-
doc_index.search({tag: ["Cat"]})
-
doc_index.search({tag: ["Dog"]})
I would also like to support partial search, so this will also work:
-
doc_index.search({tag: ["Do"]})
But I want them to be treated differently from the rest of the content. i.e. documents with {content: 'dog'}
shouldn't match.
What's the easiest way to accomplish this?
(I know I can lowercase when storing the tags, but that would require duplicating the data because I need the original)
Btw I like the new release so far. Search seems more stable!
Just to clarify a point, I'm doing this together with a regular search. So an actual query will look something like:
doc_index.search("some phrase", {tag: ["dog"]})
And I want to find the intersection of both conditions.
Partial search on tags isnt supported. Just add the tag field to the index to enable this feature. Case-insensitive for tags will come in next version.