Lucene case sensitive & insensitive search

后端 未结 2 757
说谎
说谎 2021-01-12 00:01

I have a Lucene index which is currently case sensitive. I want to add the option of having a case insensitive search as a fall-back. This means that result

相关标签:
2条回答
  • 2021-01-12 00:07

    The Lucene search is case sensitive, it's just that all input is usually lower-cased upon passing through Queryparser , so it feels like it's case insensitive. In other words, don't lower-case your input before indexing, and don't lower-case your queries (i.e. pick an Analyzer that doesn't lower-case) keyword-analyzer for example.

    [setLowercaseExpandedTerms][1](boolean lowercaseExpandedTerms)
    

    you can index the terms using case sensitive analyzer and when u want case-insensitive query use a class which doesnot convert your terms to lowercase

    look at Wildcard, Prefix, and Fuzzy queries

    0 讨论(0)
  • 2021-01-12 00:12

    Did you already tried copyField? see http://wiki.apache.org/solr/SchemaXml#Copy_Fields

    If not define a new field B with a different configuration and copy field A into B via copyField

    0 讨论(0)
提交回复
热议问题