0

我在列上创建了一个 lucene(3.0.1) 索引以在文本中搜索,在测试此文本时:

$GLD is a great example of why it does not make sense EVER to try and catch a falling knife.

如果我按关键字搜索,它会给我结果,"falling"但我在搜索时一无所获"$GLD"

我正在使用标准分析器:

String longString = "$GLD is a great example of why it does not make sense EVER to try and catch a falling knife."

Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_30);
doc.add(new Field("data", longString, Store.YES, Field.Index.ANALYZED));

因为Field.Index.ANALYZED设置它应该创建令牌并且$GLD应该存在。分析器将从文本中删除停用词,$GLD在此过程中单词也会被删除。

4

3 回答 3

0

Your document's field is changed by Analyzer. Why don't you use Analyzer on your query before you search. Meanwhile a QueryParser would help a lot.

于 2013-08-15T04:12:50.237 回答
0

It also helps to use Luke to check that your query does what you think it does.

于 2013-08-16T18:49:39.503 回答
0

您应该检查StandardAnalyzer,StandardAnalyzer可以删除$并可以LowerCaseFilter在其过程中使用(我不确定,我只知道 2.3 和 4.1)。LowerCaseFilter将使单词小写。当您搜索大写字母时,您将一无所获。

您可以使用 Luke 检查索引中的标记化结果。

于 2013-08-15T05:35:46.803 回答