how to use CachingWrapperFilter correctly and effectively in Lucene

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

how to use CachingWrapperFilter correctly and effectively in Lucene

doglin82
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 | Threaded
Open this post in threaded view
|

RE: how to use CachingWrapperFilter correctly and effectively in Lucene

Uwe Schindler-2
Hi,

This question is about Lucene.NET, which is not part of the Apache Lucene project. Please send your questions to the Lucene.NET mailing list: [hidden email]

Uwe

-----
Uwe Schindler
[hidden email]
Apache Lucene PMC Member / Committer
Bremen, Germany
http://lucene.apache.org/

> -----Original Message-----
> From: doglin82 [mailto:[hidden email]]
> Sent: Wednesday, March 11, 2015 8:23 PM
> To: [hidden email]
> Subject: how to use CachingWrapperFilter correctly and effectively in Lucene
>
> 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
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/how-to-
> use-CachingWrapperFilter-correctly-and-effectively-in-Lucene-
> tp4192491.html
> Sent from the Lucene - General mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: how to use CachingWrapperFilter correctly and effectively in Lucene

Itamar Syn-Hershko-2
It is a Lucene API question so applies to both

1) Make sure CWF is kept alive somewhere; also take a look at its
refreshing configuration (second parameter)

2) Yes, this query is still being executed

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Lucene.NET committer and PMC member

On Wed, Mar 11, 2015 at 9:29 PM, Uwe Schindler <[hidden email]>
wrote:

> Hi,
>
> This question is about Lucene.NET, which is not part of the Apache Lucene
> project. Please send your questions to the Lucene.NET mailing list:
> [hidden email]
>
> Uwe
>
> -----
> Uwe Schindler
> [hidden email]
> Apache Lucene PMC Member / Committer
> Bremen, Germany
> http://lucene.apache.org/
>
> > -----Original Message-----
> > From: doglin82 [mailto:[hidden email]]
> > Sent: Wednesday, March 11, 2015 8:23 PM
> > To: [hidden email]
> > Subject: how to use CachingWrapperFilter correctly and effectively in
> Lucene
> >
> > 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
> >
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.nabble.com/how-to-
> > use-CachingWrapperFilter-correctly-and-effectively-in-Lucene-
> > tp4192491.html
> > Sent from the Lucene - General mailing list archive at Nabble.com.
>
>