You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Senthilnathan Vijayaraja <se...@8kmiles.com> on 2014/02/25 15:07:44 UTC

programmatically disable/enable solr queryResultCache...

is there any way programmatically disable/enable solr queryResultCache?

I am using SolrJ.


Thanks & Regards,
Senthilnathan V

Re: programmatically disable/enable solr queryResultCache...

Posted by Senthilnathan Vijayaraja <se...@8kmiles.com>.
Shalin,

   Great,Thanks for the clear explanation. let me try to make my scoring
function as part of QueryResultKey.

Thanks & Regards,
Senthilnathan V


On Wed, Feb 26, 2014 at 5:40 PM, Shalin Shekhar Mangar <
shalinmangar@gmail.com> wrote:

> The problem here is that your custom scoring function (is that a
> SearchComponent?) is not part of a query. The query cache is defined
> as SolrCache<QueryResultKey,DocList> where the QueryResultKey contains
> Query, Sort, SortField[] and filters=List<Query>. So your custom
> scoring function either needs to be present in the QueryResultKey or
> else you need to disable the query result cache via configuration.
>
> On Wed, Feb 26, 2014 at 12:09 PM, Senthilnathan Vijayaraja
> <se...@8kmiles.com> wrote:
> > Erick,
> >          Thanks for the response.
> >
> > Kindly have a look at my sample query,
> >
> > select?fl=city,$score&q=*:*&fq={!lucene q.op=OR df=city
> v=$cit}&cit=Chennai&
> >
> > *sort=$score desc& score=norm($la,value,10)& la=8 &b=1&c=2*here,
> > score= norm($la,value,10), norm  is a custom function
> >
> > *,if I change la then the $score will change.*
> > first time it work fine but if I am changing la alone and firing the
> query
> > again the result remains in the same order as first query result.Which
> > means sorting is not happening even the score is different.But If I am
> > changing the cit=Chennai to cit=someCity  then I am getting result in
> > proper order,means sorting works fine.
> >
> > At any rate, queryResultCache is unlikely to impact
> > much. All it is is
> > *a map containing the query and the first few document IDs *(internal
> > Lucene).
> >
> > which means query is the unique key and list of document ids are values
> > mapped with that key.If I am not wrong,
> >
> > may I know how solr builds the unique keys based on the queries.
> >
> > Whether it builds the key based on only solr common query parameters or
> it
> > will include all the parameters supplied by user as part of query(for e.g
> > la=8&b=1&c=2 ).
> >
> >
> > any clue?
> >
> >
> > Thanks & Regards,
> > Senthilnathan V
> >
> >
> > On Tue, Feb 25, 2014 at 8:00 PM, Erick Erickson <erickerickson@gmail.com
> >wrote:
> >
> >> This seems like an XY problem, you're asking for
> >> specifics on doing something without any indication
> >> _why_ you think this would help. Nor are you explaining
> >> what the problem you're having is in the first place.
> >>
> >> At any rate, queryResultCache is unlikely to impact
> >> much. All it is is a map containing the query and
> >> the first few document IDs (internal Lucene). See
> >> <queryResultWindowSize> in solrconfig.xml. It is
> >> quite light-weight, it does NOT store the entire
> >> result set, nor even the contents of the documents.
> >>
> >> Best
> >> Erick
> >>
> >>
> >> On Tue, Feb 25, 2014 at 6:07 AM, Senthilnathan Vijayaraja <
> >> senthilnathan@8kmiles.com> wrote:
> >>
> >> > is there any way programmatically disable/enable solr
> queryResultCache?
> >> >
> >> > I am using SolrJ.
> >> >
> >> >
> >> > Thanks & Regards,
> >> > Senthilnathan V
> >> >
> >>
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>

Re: programmatically disable/enable solr queryResultCache...

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
The problem here is that your custom scoring function (is that a
SearchComponent?) is not part of a query. The query cache is defined
as SolrCache<QueryResultKey,DocList> where the QueryResultKey contains
Query, Sort, SortField[] and filters=List<Query>. So your custom
scoring function either needs to be present in the QueryResultKey or
else you need to disable the query result cache via configuration.

On Wed, Feb 26, 2014 at 12:09 PM, Senthilnathan Vijayaraja
<se...@8kmiles.com> wrote:
> Erick,
>          Thanks for the response.
>
> Kindly have a look at my sample query,
>
> select?fl=city,$score&q=*:*&fq={!lucene q.op=OR df=city v=$cit}&cit=Chennai&
>
> *sort=$score desc& score=norm($la,value,10)& la=8 &b=1&c=2*here,
> score= norm($la,value,10), norm  is a custom function
>
> *,if I change la then the $score will change.*
> first time it work fine but if I am changing la alone and firing the query
> again the result remains in the same order as first query result.Which
> means sorting is not happening even the score is different.But If I am
> changing the cit=Chennai to cit=someCity  then I am getting result in
> proper order,means sorting works fine.
>
> At any rate, queryResultCache is unlikely to impact
> much. All it is is
> *a map containing the query and the first few document IDs *(internal
> Lucene).
>
> which means query is the unique key and list of document ids are values
> mapped with that key.If I am not wrong,
>
> may I know how solr builds the unique keys based on the queries.
>
> Whether it builds the key based on only solr common query parameters or it
> will include all the parameters supplied by user as part of query(for e.g
> la=8&b=1&c=2 ).
>
>
> any clue?
>
>
> Thanks & Regards,
> Senthilnathan V
>
>
> On Tue, Feb 25, 2014 at 8:00 PM, Erick Erickson <er...@gmail.com>wrote:
>
>> This seems like an XY problem, you're asking for
>> specifics on doing something without any indication
>> _why_ you think this would help. Nor are you explaining
>> what the problem you're having is in the first place.
>>
>> At any rate, queryResultCache is unlikely to impact
>> much. All it is is a map containing the query and
>> the first few document IDs (internal Lucene). See
>> <queryResultWindowSize> in solrconfig.xml. It is
>> quite light-weight, it does NOT store the entire
>> result set, nor even the contents of the documents.
>>
>> Best
>> Erick
>>
>>
>> On Tue, Feb 25, 2014 at 6:07 AM, Senthilnathan Vijayaraja <
>> senthilnathan@8kmiles.com> wrote:
>>
>> > is there any way programmatically disable/enable solr queryResultCache?
>> >
>> > I am using SolrJ.
>> >
>> >
>> > Thanks & Regards,
>> > Senthilnathan V
>> >
>>



-- 
Regards,
Shalin Shekhar Mangar.

Re: programmatically disable/enable solr queryResultCache...

Posted by Senthilnathan Vijayaraja <se...@8kmiles.com>.
Erick,
         Thanks for the response.

Kindly have a look at my sample query,

select?fl=city,$score&q=*:*&fq={!lucene q.op=OR df=city v=$cit}&cit=Chennai&

*sort=$score desc& score=norm($la,value,10)& la=8 &b=1&c=2*here,
score= norm($la,value,10), norm  is a custom function

*,if I change la then the $score will change.*
first time it work fine but if I am changing la alone and firing the query
again the result remains in the same order as first query result.Which
means sorting is not happening even the score is different.But If I am
changing the cit=Chennai to cit=someCity  then I am getting result in
proper order,means sorting works fine.

At any rate, queryResultCache is unlikely to impact
much. All it is is
*a map containing the query and the first few document IDs *(internal
Lucene).

which means query is the unique key and list of document ids are values
mapped with that key.If I am not wrong,

may I know how solr builds the unique keys based on the queries.

Whether it builds the key based on only solr common query parameters or it
will include all the parameters supplied by user as part of query(for e.g
la=8&b=1&c=2 ).


any clue?


Thanks & Regards,
Senthilnathan V


On Tue, Feb 25, 2014 at 8:00 PM, Erick Erickson <er...@gmail.com>wrote:

> This seems like an XY problem, you're asking for
> specifics on doing something without any indication
> _why_ you think this would help. Nor are you explaining
> what the problem you're having is in the first place.
>
> At any rate, queryResultCache is unlikely to impact
> much. All it is is a map containing the query and
> the first few document IDs (internal Lucene). See
> <queryResultWindowSize> in solrconfig.xml. It is
> quite light-weight, it does NOT store the entire
> result set, nor even the contents of the documents.
>
> Best
> Erick
>
>
> On Tue, Feb 25, 2014 at 6:07 AM, Senthilnathan Vijayaraja <
> senthilnathan@8kmiles.com> wrote:
>
> > is there any way programmatically disable/enable solr queryResultCache?
> >
> > I am using SolrJ.
> >
> >
> > Thanks & Regards,
> > Senthilnathan V
> >
>

Re: programmatically disable/enable solr queryResultCache...

Posted by Erick Erickson <er...@gmail.com>.
This seems like an XY problem, you're asking for
specifics on doing something without any indication
_why_ you think this would help. Nor are you explaining
what the problem you're having is in the first place.

At any rate, queryResultCache is unlikely to impact
much. All it is is a map containing the query and
the first few document IDs (internal Lucene). See
<queryResultWindowSize> in solrconfig.xml. It is
quite light-weight, it does NOT store the entire
result set, nor even the contents of the documents.

Best
Erick


On Tue, Feb 25, 2014 at 6:07 AM, Senthilnathan Vijayaraja <
senthilnathan@8kmiles.com> wrote:

> is there any way programmatically disable/enable solr queryResultCache?
>
> I am using SolrJ.
>
>
> Thanks & Regards,
> Senthilnathan V
>