You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by doglin82 <ka...@bellmedia.ca> on 2015/03/11 20:22:57 UTC

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.

Re: how to use CachingWrapperFilter correctly and effectively in Lucene

Posted by Itamar Syn-Hershko <it...@code972.com>.
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 <us...@apache.org>
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:
> user@lucenenet.apache.org
>
> Uwe
>
> -----
> Uwe Schindler
> uschindler@apache.org
> Apache Lucene PMC Member / Committer
> Bremen, Germany
> http://lucene.apache.org/
>
> > -----Original Message-----
> > From: doglin82 [mailto:karen.lin@bellmedia.ca]
> > Sent: Wednesday, March 11, 2015 8:23 PM
> > To: general@lucene.apache.org
> > 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.
>
>

Re: how to use CachingWrapperFilter correctly and effectively in Lucene

Posted by Itamar Syn-Hershko <it...@code972.com>.
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 <us...@apache.org>
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:
> user@lucenenet.apache.org
>
> Uwe
>
> -----
> Uwe Schindler
> uschindler@apache.org
> Apache Lucene PMC Member / Committer
> Bremen, Germany
> http://lucene.apache.org/
>
> > -----Original Message-----
> > From: doglin82 [mailto:karen.lin@bellmedia.ca]
> > Sent: Wednesday, March 11, 2015 8:23 PM
> > To: general@lucene.apache.org
> > 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.
>
>

RE: how to use CachingWrapperFilter correctly and effectively in Lucene

Posted by Uwe Schindler <us...@apache.org>.
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: user@lucenenet.apache.org

Uwe

-----
Uwe Schindler
uschindler@apache.org 
Apache Lucene PMC Member / Committer
Bremen, Germany
http://lucene.apache.org/

> -----Original Message-----
> From: doglin82 [mailto:karen.lin@bellmedia.ca]
> Sent: Wednesday, March 11, 2015 8:23 PM
> To: general@lucene.apache.org
> 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.


RE: how to use CachingWrapperFilter correctly and effectively in Lucene

Posted by Uwe Schindler <us...@apache.org>.
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: user@lucenenet.apache.org

Uwe

-----
Uwe Schindler
uschindler@apache.org 
Apache Lucene PMC Member / Committer
Bremen, Germany
http://lucene.apache.org/

> -----Original Message-----
> From: doglin82 [mailto:karen.lin@bellmedia.ca]
> Sent: Wednesday, March 11, 2015 8:23 PM
> To: general@lucene.apache.org
> 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.