flexsearch icon indicating copy to clipboard operation
flexsearch copied to clipboard

Case-insensitive tag search?

Open erezsh opened this issue 2 years ago • 1 comments

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!

erezsh avatar Nov 01 '21 16:11 erezsh

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.

erezsh avatar Nov 01 '21 17:11 erezsh

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.

ts-thomas avatar Oct 02 '22 15:10 ts-thomas