Lucene 查询不搜索词"an"
Lucene query does not search for word "an"
我编写了一个 lucene 搜索程序,用于搜索用户在实体的每个字段中输入的所有术语。这行得通,但现在我对 "an".
这个词有疑问
具体来说,我想以任何顺序搜索单词 "receptions de nouvel an"
我的查询如下所示:
+description:*receptions* +description:*de* +description:*nouvel* +description:*an*
这没有给我任何结果,但我知道应该有 3 个结果。
- 新的接受度 MDDI/PCH
- 2011 年新品招待会
- 2010 年的新品招待会
当我进行这样的查询时
+description:*receptions* +description:*de* +description:*nouvel*
我得到了预期的结果。所以看来工作有问题"an".
有没有人告诉我这里出了什么问题以及为什么我的第一个查询不起作用?
提前致谢
标准分析器默认使用 EnglishStopWords CharArraySet,其中还包括 "a,an,the" ex。如果你想让这些词被索引,那么你可能会使用一些自定义的 CharArraySet 或者像在 blove ride off the StopWords
analyzer = new StandardAnalyzer(CharArraySet.EMPTY_SET);
我编写了一个 lucene 搜索程序,用于搜索用户在实体的每个字段中输入的所有术语。这行得通,但现在我对 "an".
这个词有疑问具体来说,我想以任何顺序搜索单词 "receptions de nouvel an"
我的查询如下所示:
+description:*receptions* +description:*de* +description:*nouvel* +description:*an*
这没有给我任何结果,但我知道应该有 3 个结果。
- 新的接受度 MDDI/PCH
- 2011 年新品招待会
- 2010 年的新品招待会
当我进行这样的查询时
+description:*receptions* +description:*de* +description:*nouvel*
我得到了预期的结果。所以看来工作有问题"an".
有没有人告诉我这里出了什么问题以及为什么我的第一个查询不起作用? 提前致谢
标准分析器默认使用 EnglishStopWords CharArraySet,其中还包括 "a,an,the" ex。如果你想让这些词被索引,那么你可能会使用一些自定义的 CharArraySet 或者像在 blove ride off the StopWords
analyzer = new StandardAnalyzer(CharArraySet.EMPTY_SET);