exception - 使用 Lucene : Why do I get a Too Many Clauses error if I do a prefix search?

标签 exception lucene

我有一个应用程序进行前缀搜索有一段时间了。最近索引大小增加了,结果发现一些前缀太多了,lucene 无法处理。它不断向我抛出 Too Many Clauses错误,这非常令人沮丧,因为我一直在查看我的 JAR 并确认所包含的代码实际上都没有使用 bool 查询。
为什么它不抛出像 Too Many Hits 这样的异常?为什么增加 bool 查询的静态 max 子句整数实际上会使这个错误消失,当我绝对只使用前缀查询时?是否有一些我不理解的查询运行方式的基本原理;是不是它们偷偷变成了 bool 查询?

最佳答案

我以前打过这个。它与以下事实有关,即在调用 Query.rewrite() 时,lucene 在幕后将许多(所有?)事物转换为 bool 查询
发件人:http://web.archive.org/web/20110915061619/http://lucene.apache.org:80/java/2_2_0/api/org/apache/lucene/search/Query.html

public Query rewrite(IndexReader reader)
              throws IOException

    Expert: called to re-write queries into primitive queries.
            For example, a PrefixQuery will be rewritten into a
            BooleanQuery that consists of TermQuerys.

    Throws:
        IOException

关于exception - 使用 Lucene : Why do I get a Too Many Clauses error if I do a prefix search?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8532/

相关文章:

java - 删除 ArrayList 元素时出现 IndexOutOfBoundsException

go - 当 HTTP 客户端向不可用的 URL 发出请求时如何捕捉 panic ?

java - 用java制作一个包含数组和文件输入的表格

lucene - 更新 Solr 架构

java - 使用 Lucene SearchAfter 示例

php - 使用堆栈跟踪记录捕获的异常

c# - 未处理的异常未被 `Application.ThreadException` 捕获?

java - 如何在Solr中对多个字段进行嵌套聚合?

filter - Hibernate 搜索中的重复过滤器

java - 尝试使用 lucene 获得更多匹配