lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karen Lin <>
Subject how to use CachingWrapperFilter correctly and effectively in
Date Wed, 11 Mar 2015 19:32:02 GMT
We are using Lucene for our web site and as the index grew, we got the following exception
due to too many clause.

the Message: maxClauseCount is set to 1024 Stack Trace:
at Lucene.Net.Search.BooleanQuery.Add(BooleanClause clause) at
So I did some research and added a CachingWrapperFilter , my code now looks like this

BooleanQuery bq = new BooleanQuery();

//publishedQuery is set to BooleanQuery
    bq.Add(publishedQuery, BooleanClause.Occur.MUST);

var sortBy = customSort ?? new Sort(Sort.RELEVANCE.GetSort());

           Filter filter = new QueryFilter(bq);
            CachingWrapperFilter cachingFilter = new CachingWrapperFilter(filter);

            var results = _searcher.Search(bq, cachingFilter,sortBy);
I want to know
1) If I am using the CachingWrapperFilter correct and effectively
2) Do I still need to set the Max Clause to 4096 if I am using CachingWrapper Filter, default
is 1024 for max clause count

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message