By default word "Word" and "word" are not the same. How can I make Lucene be case-insensitive?
Lucene search is case-sensitive, but all input is usually lowercased when passing through QueryParser, so it feels like it is case insensitive (This is the case of the findBySimpleQuery() method. In other words, don't lowercase your input before indexing, and don't lowercase your queries.
Why is Lucene faster? Lucene is very fast at searching for data because of its inverted index technique. Normally, datasources structure the data as an object or record, which in turn have fields and values.
In addition to using the StandardAnalyzer
, which includes LowerCaseFilter
and filters for common English words (such as "the"), you should also ensure you build your document using TextField
s, not StringField
which are for exact searches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With