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());
            BooleanQuery.SetMaxClauseCount(4096);

           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

Reply via email to