Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make lucene be case-insensitive

Tags:

java

lucene

By default word "Word" and "word" are not the same. How can I make Lucene be case-insensitive?

like image 795
Eugeny89 Avatar asked Apr 01 '11 11:04

Eugeny89


People also ask

Is Lucene case sensitive?

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 Lucene is so fast?

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.


1 Answers

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 TextFields, not StringField which are for exact searches.

like image 155
Luchio Avatar answered Sep 21 '22 19:09

Luchio