我在列上创建了一个 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
在此过程中单词也会被删除。