Re: programmatically disable/enable solr queryResultCache...

2014-02-26 Thread Senthilnathan Vijayaraja
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 <
shalinman...@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 where the QueryResultKey contains
> Query, Sort, SortField[] and filters=List. 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
>  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  >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
> >>  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 <
> >> senthilnat...@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...

2014-02-25 Thread Senthilnathan Vijayaraja
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 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
>  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 <
> senthilnat...@8kmiles.com> wrote:
>
> > is there any way programmatically disable/enable solr queryResultCache?
> >
> > I am using SolrJ.
> >
> >
> > Thanks & Regards,
> > Senthilnathan V
> >
>


programmatically disable/enable solr queryResultCache...

2014-02-25 Thread Senthilnathan Vijayaraja
is there any way programmatically disable/enable solr queryResultCache?

I am using SolrJ.


Thanks & Regards,
Senthilnathan V


Re: Reg queryResultCache...

2014-02-24 Thread Senthilnathan Vijayaraja
Hi,


select?br="2"+"3"&version=2&fl=id,level,name,city,amenities,$lanorm,$relscore,$bscore&q=*:*&fq={!lucene
q.op=OR df=property_type v=$ptype}&ptype=1&fq={!lucene q.op=OR df=city
v=$cit}&sort=$bscore desc,$relscore
desc&cit=Chennai&relscore=product($banorm,15)&bscore=banorm($la,amenities,10)&la=8

this is the sample query.

banorm($la,amenities,10) , banorm is the custom function,la is the user
input and 10 is some constant vale.

if la=8 then the results should be,and it is working fine

name:ABC
city: "Chennai",
propertyType: [1],
baNorm: 0.4,
relScore: 6,
bScore: 3001

name:XYZ
city: "Chennai",
propertyType: [1],
baNorm: 0.4,
relScore: 6,
bScore: 3001

name:PQR
city: "Chennai",
propertyType: [1],
baNorm: 0,
relScore: 0,
bScore: 2001

if we are changing the la to 24(i.e la=24) again the results are being
displayed in the same order as first query but the bscore and relscore
values are different,which means the result is not sorted.

select?br="2"+"3"&version=2&fl=id,level,name,city,amenities,$lanorm,$relscore,$bscore&q=*:*&fq={!lucene
q.op=OR df=property_type v=$ptype}&ptype=1&fq={!lucene q.op=OR df=city
v=$cit}&sort=$bscore desc,$relscore
desc&cit=Chennai&relscore=product($banorm,15)&bscore=banorm($la,amenities,10)&la=24

name:ABC
city: "Chennai",
propertyType: [1],
baNorm: 0,
relScore: 0,
bScore: 2001

name:XYZ
city: "Chennai",
propertyType: [1],
baNorm: 0.6,
relScore: 9,
bScore: 4001

name:PQR
city: "Chennai",
propertyType: [1],
baNorm: 0.4,
relScore: 6,
bScore: 3001


Thanks & Regards,
Senthilnathan V


On Mon, Feb 24, 2014 at 7:04 PM, Shalin Shekhar Mangar <
shalinman...@gmail.com> wrote:

> Please provide the *Solr* queries that are being invoked by your
> middle layer along with the results you expect and the results you
> actually got from Solr with cache-enabled.
>
> On Mon, Feb 24, 2014 at 6:23 PM, Senthilnathan Vijayaraja
>  wrote:
> > Below is the url which will hit the middle layer then middle layer will
> > form the solr query and fire it.
> >
> >
> *listing?offset=0&sortparam=0&limit=20&q=Chennai~Tambaram~1~2,3~45~2500~800~2000~~24*
> >
> >
> > Chennai-->city
> > Tambaram-->locality
> > 1-->blah
> > 2,3-->blah
> > 45~2500-->price_min and max
> > 800~2000-->area min and max
> > *24--lux_ amenities*
> >
> > here other than lux_amenities I am using fq for all other things,so the
> > problem here is sorting.
> >
> > I am sorting the results using bscore and relscore likebelow,
> >
> > *$bscore desc,$relscore desc*
> >
> > first time it works fine.
> >
> > above bscore and relscore will change based on lux_amenities but
> > lux_amenities is neither part of fq  nor q.So if second time we are
> > changing the lux_amenities alone and firing the query means it is giving
> > the result in same order as first query even the bscore and relscore are
> > different.
> >
> > So I disabled the queryResultCache,
> >
> > 
> >
> > Now it is working fine. But I need a better solution than disabling this
> > for all queries.For eg, I want to disable this for few queries alone not
> > for all.
> >
> >
> > Could someone help me please..
> >
> >
> > Thanks & Regards,
> > Senthilnathan V
>
>
>
> --
> Regards,
> Shalin Shekhar Mangar.
>


Reg queryResultCache...

2014-02-24 Thread Senthilnathan Vijayaraja
Below is the url which will hit the middle layer then middle layer will
form the solr query and fire it.

*listing?offset=0&sortparam=0&limit=20&q=Chennai~Tambaram~1~2,3~45~2500~800~2000~~24*


Chennai-->city
Tambaram-->locality
1-->blah
2,3-->blah
45~2500-->price_min and max
800~2000-->area min and max
*24--lux_ amenities*

here other than lux_amenities I am using fq for all other things,so the
problem here is sorting.

I am sorting the results using bscore and relscore likebelow,

*$bscore desc,$relscore desc*

first time it works fine.

above bscore and relscore will change based on lux_amenities but
lux_amenities is neither part of fq  nor q.So if second time we are
changing the lux_amenities alone and firing the query means it is giving
the result in same order as first query even the bscore and relscore are
different.

So I disabled the queryResultCache,



Now it is working fine. But I need a better solution than disabling this
for all queries.For eg, I want to disable this for few queries alone not
for all.


Could someone help me please..


Thanks & Regards,
Senthilnathan V


pagination with grouping

2014-01-06 Thread Senthilnathan Vijayaraja
Hi,

i am using group.query like below,

  group=true&
  group.query=_query_:{!frange l=0 u=10 v=$score}&
  group.query=_query_:{!frange l=10 u=20 v=$score}&
  group.query=_query_:{!frange l=20 u=30 v=$score}

here I want to restrict the overall record counts, start=0&rows=10 is not
working here.
within the group level we can do this using offset=0&group.limit=10.

for eg>I want only 10 records, if the first group
group.query=_query_:{!frange l=0 u=10 v=$score} contain 10 records,i don't
need records from other two groups.

could someone help me please.



Thanks & Regards,
Senthilnathan V


Dynamically deriving the param value in solrconfig requestHandler

2013-12-18 Thread Senthilnathan Vijayaraja
hi,

 Is there any possibility to derive a value to a param from other params
like below,


  
   query
   debug
  
  
   *size:['$minSize' TO '$maxSize'] *
//minSize and maxSize will be supplied as query parameter or else
defaults
to below values((i.e size_relaxed=size:[0 TO 1] ))

*0  1*
  
 


Thanks & Regards,
Senthilnathan V


Re: Fallback Local Requests

2013-12-17 Thread Senthilnathan Vijayaraja
Hi Ahmet,

 It seems like it will bring more complexity than what I did. But of
course it is easily customizable.Worthy alternate approach to think
of.Thanks.

Thanks & Regards,
Senthilnathan v


Thanks & Regards,
Senthilnathan V


On Tue, Dec 17, 2013 at 6:44 PM, Ahmet Arslan  wrote:

> Hi Senthilnathan,
>
> I not 100% sure but I https://issues.apache.org/jira/browse/SOLR-5005could be 
> used such cases.
>
>
>
>
>
> On Tuesday, December 17, 2013 2:56 PM, Senthilnathan Vijayaraja <
> senthilnat...@8kmiles.com> wrote:
> Hi,
>
> my query format is,
>
> q=(price_min:[10 TO 80] OR price_max:[10 TO 80])AND
> (size_min:[1000 TO 5000] OR size_max:[1000 TO 5000])
>
>   if this query returns 0 results then
> -->fire a fallback query after changing the value of size_min and
> size_max
> q=(price_min:[10 TO 80] OR price_max:[10 TO 80])AND
> (size_min:[100 TO 500] OR size_max:[100 TO 500])
>   if, again it gives 0 results then
> -->fire a fallback query after changing the value of price_min and
> price_max
> q=(price_min:[1000 TO 8000] OR price_max:[1000 TO 8000])AND
> (size_min:[100 TO 500] OR size_max:[100 TO 500])
>
> I wrote a custom request handler to achieve this and now it is
> working fine but in my code,
>
> I got the value of 'q' param like,
>
> String[] paramVals = reqParams.getParams("q");//(price_min:[10
> TO 80] OR price_max:[10 TO 80])AND (size_min:[1000 TO 5000] OR
> size_max:[1000 TO 5000])
>
> and  manually replaced the price_min,price_max,size_min,size_max
> values using string functions,there by I formed two LocalRequests for
> handling  this.
>
>
> Is there any better way to handle this,I want this to be more
> configurable..???
>
>
>
>
>
> Thanks & Regards,
> Senthilnathan V
>
>


Re: Fallback Local Requests

2013-12-17 Thread Senthilnathan Vijayaraja
Hoss..

--> I strongly advise anyone who asks me 99% of the time "fall back" queries
 for 0 results found are a really bad idea, because they can easily
create
 very strange user experiences.

yes, I do agree it will create strange user experience in most of the
cases.But in my case I need to show some results that is closely related to
the user instead of saying "no results found".

for Eg. user may be looking for the mobile-phone costs below $5000,white
color,samsung,jelly bean,etc..

I have mobile-phones with all these specification but price is
$5005.Instead of giving 0 result I want to show this.I cannot go back and
ask for the requirement change.

thanks for the useful links.

Thanks & Regards,
Senthilnathan v


Thanks & Regards,
Senthilnathan V


On Tue, Dec 17, 2013 at 9:28 PM, Chris Hostetter
wrote:

>
> : Subject: Fallback Local Requests
>
> ...
>
> :   if this query returns 0 results then
> : -->fire a fallback query after changing the value of size_min and
> : size_max
>
> I strongly advise anyone who asks me 99% of the time "fall back" queries
> for 0 results found are a really bad idea, because they can easily create
> very strange user experiences.
>
> Check out slide #11, the "Fallback" example ~ 14:50 ...
>
> https://people.apache.org/~hossman/ac2012eu/#slide11
> http://vimeopro.com/user11514798/apache-lucene-eurocon-2012/video/55822630
>
> ...watch the whole video for an in depth discussion on how to take
> advantage of domain knowledge to *boost* documents based on important
> criteria so they score higher instead of using sledgehammers like fallback
> queries.
>
>
> -Hoss
> http://www.lucidworks.com/
>


Fallback Local Requests

2013-12-17 Thread Senthilnathan Vijayaraja
Hi,

my query format is,

q=(price_min:[10 TO 80] OR price_max:[10 TO 80])AND
(size_min:[1000 TO 5000] OR size_max:[1000 TO 5000])

  if this query returns 0 results then
-->fire a fallback query after changing the value of size_min and
size_max
q=(price_min:[10 TO 80] OR price_max:[10 TO 80])AND
(size_min:[100 TO 500] OR size_max:[100 TO 500])
  if, again it gives 0 results then
-->fire a fallback query after changing the value of price_min and
price_max
q=(price_min:[1000 TO 8000] OR price_max:[1000 TO 8000])AND
(size_min:[100 TO 500] OR size_max:[100 TO 500])

I wrote a custom request handler to achieve this and now it is
working fine but in my code,

I got the value of 'q' param like,

String[] paramVals = reqParams.getParams("q");//(price_min:[10
TO 80] OR price_max:[10 TO 80])AND (size_min:[1000 TO 5000] OR
size_max:[1000 TO 5000])

and  manually replaced the price_min,price_max,size_min,size_max
values using string functions,there by I formed two LocalRequests for
handling  this.


Is there any better way to handle this,I want this to be more
configurable..???





Thanks & Regards,
Senthilnathan V