java - Carrot2 在搜索时不显示所有包含特定单词的簇

标签 java indexing lucene clustered-index carrot2

我选择了一些包含特定单词的行,例如 StackOverFlow从我的数据库中并将它们保存在文本文件中。 然后,我使用 Lucene 来索引文件内容。

当我尝试搜索StackOverFlow时在使用 Carrot2 的索引文件上,它不返回任何文档,但换句话说,我知道它们至少存在于一个文档中,它会返回其中的一些文档。

在Carrot2文档中,有一个关于 Maximum word document frequency 属性的解释:

Maximum word document frequency. The maximum document frequency allowed for words as a fraction of all documents. Words with document frequency larger than maxWordDf will be ignored. For example, when maxWordDf is 0.4, words appearing in more than 40% of documents will be be ignored. A value of 1.0 means that all words will be taken into account, no matter in how many documents they appear. This attribute may be useful when certain words appear in most of the input documents (e.g. company name from header or footer) and such words dominate the cluster labels. In such case, setting maxWordDf to a value lower than 1.0, e.g. 0.9 may improve the clusters.

Another useful application of this attribute is when there is a need to generate only very specific clusters, i.e. clusters containing small numbers of documents. This can be achieved by setting maxWordDf to extremely low values, e.g. 0.1 or 0.05.

所以,当我设置maxWordDf时到 1.0,没有任何变化,并且在搜索中仍然不显示任何文档。

如何解决我的问题?

最佳答案

搜索结果中文档缺失的原因通常是用于索引文档的分析器与 Carrot2 在搜索过程中使用的分析器不匹配。默认情况下,Carrot2 使用 Lucene 的 StandardAnalyzer,您可以使用 LuceneDocumentSource.analyzer 提供不同的分析器。属性。

关于java - Carrot2 在搜索时不显示所有包含特定单词的簇,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49095981/

相关文章:

java - 如何在 Java Web 项目中引发无法捕获并结束执行的异常?

arrays - 不能在下标中使用索引

lucene - Sitecore Search Predicate Builder 多关键字搜索与 boosting 无法按预期工作

java - SolR 限制每个文件的点击次数

php - 根据 bool 字段值提升Elasticsearch结果

java - 我们如何检查 javaFx 应用程序是否已经在运行?

java - fragment 布局问题

java - JPanel:嵌套 GridLayout 表边框之间的额外空格

c++ - Visual Studio 是否支持 C++ 代码索引?

c++ - 编写 C++ 程序以从 Linux 命令行搜索索引文件