为什么我无法搜索未存储的字段AND关键字字段?

时间:2022-10-29 03:14:11

I have a lucene application and it work's well, index and search, except when I want to search 1 field unstored AND 1 field keyword (I have only this 2 kind of field), and I use this analyzer:

我有一个lucene应用程序,它工作得很好,索引和搜索,除非我想搜索1个字段未存储和1字段关键字(我只有这2种字段),我使用这个分析器:

Analyzer analyzer = new SnowballAnalyzer("Spanish", STOP_WORDS_SPANISH());

Analyzer analyzer = new SnowballAnalyzer(“Spanish”,STOP_WORDS_SPANISH());

IndexWriter writer = new IndexWriter(PATH(), analyzer, true);

IndexWriter writer = new IndexWriter(PATH(),analyzer,true);

And I am sure I put the unstored fields and keywords fields in the same lucene document. So I don't know what fail.

我确信我将未存储的字段和关键字字段放在同一个lucene文档中。所以我不知道失败了。

Thanks in advance :)

提前致谢 :)

1 个解决方案

#1


0  

Your search should use the same Analysis as your indexing did. As you are using two different analyzers for storage, you need to use similar analysis when searching. I suggest you use a PerFieldAnalyzerWrapper to properly match fields with their respective analyzers.

您的搜索应使用与索引相同的分析。当您使用两种不同的分析仪进行存储时,您需要在搜索时使用类似的分析。我建议您使用PerFieldAnalyzerWrapper将字段与各自的分析器正确匹配。

#1


0  

Your search should use the same Analysis as your indexing did. As you are using two different analyzers for storage, you need to use similar analysis when searching. I suggest you use a PerFieldAnalyzerWrapper to properly match fields with their respective analyzers.

您的搜索应使用与索引相同的分析。当您使用两种不同的分析仪进行存储时,您需要在搜索时使用类似的分析。我建议您使用PerFieldAnalyzerWrapper将字段与各自的分析器正确匹配。