lucene2.4.1(http://lucene.apache.org/)

 IndexReader.open(dir)、IndexWriter(dir)在dir不存在时会先创建,前者创建空dir目录,后者创建带两个索引相关文件

BooleanQuery$TooManyClauses的问题

org.apache.lucene.search.BooleanQuery$TooManyClauses: maxClauseCount is set to 1024

可以通过设置:
BooleanQuery.setMaxClauseCount(10000);
来解决问题,但是这样带来的问题是会使得内存开销加大。容易出现OutOfMemory的异常
所以需要非常谨慎处理

1 楼 caocao 2007-06-22   引用
遇到TooManyClauses一般应从设计角度切入,绝大部分是设计问题。比如rangequery精度太高导致clauses迅速膨胀。
(/// <summary>Set the maximum number of clauses permitted per BooleanQuery.
/// Default value is 1024.
/// <p>TermQuery clauses are generated from for example prefix queries and
/// fuzzy queries. Each TermQuery needs some buffer space during search,
/// so this parameter indirectly controls the maximum buffer requirements for
/// query search.
/// <p>When this parameter becomes a bottleneck for a Query one can use a
/// Filter. For example instead of a {@link RangeQuery} one can use a
/// {@link RangeFilter}.
/// <p>Normally the buffers are allocated by the JVM. When using for example
/// {@link Lucene.Net.Store.MMapDirectory} the buffering is left to
/// the operating system.
/// </summary>
public static void  SetMaxClauseCount(int maxClauseCount)

)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值