开发者

Luke Lucene QueryParser Case Sensitivity

In Luke, if I enter the search expres开发者_开发知识库sion docfile:Tomatoes.jpg* the parsed query is docfile:Tomatoes.jpg*. When the search expression is docfile:Tomatoes.jpg, (no asterisk *) the parsed query is docfile:tomatoes.jpg with a lowercase 't'.

  1. Why?
  2. How can I change this?

BTW, using org.apache.lucene.analysis.standard.StandardAnalyzer.


StandardAnalyzer uses LowerCaseFilter which means it lowercases your queries and data. This is described in the Javadocs http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/analysis/standard/StandardAnalyzer.html.

If I remember correctly WhitespaceAnalyzer does not lowercase, but verify it suits your needs http://lucene.apache.org/java/3_0_1/api/core/org/apache/lucene/analysis/WhitespaceAnalyzer.html.


For Lucene 5.3.0 the problem was solved by using the SimpleAnalyzer.

Example:

Analyzer analyzer = new org.apache.lucene.analysis.core.SimpleAnalyzer();

Finally, use the same analyzer for building the index and searching.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜