lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: FunctionQuery score=0
Date Wed, 23 Nov 2011 18:35:11 GMT

: Which answers my query needs. BUT, my boost function actually changes some
: of the results to be of score 0, which I want to be excluded from the
: result set.

Ok .. so the crux of the issue is that your boost function results in a 
value of 0 for some documents, and you would like those documents excluded 
from your results...


"eqsim" is not a function thta ships with Solr (as far as i know) so i'm 
guessing it's something custom .. can you clarify what it does?

: 2) This is why I used the frange query to solve the issue with the score 0:
: q={!frange l=0 incl=false}query({!type=edismax qf="abstract^0.02 title^0.08
: categorysearch^0.05" boost='eqsim(alltokens,"xyz")' v='+tokens5:"xyz" '})
: But this time, the remaining results lost their *boosted* scores, and
: therefore the sort by score got all mixed up.

correct: frange produces a ConstantScoreQuery, it can only be used to 
filter documents based on wether the function it wraps falls in/out of the 

: 3) I assume I can use filter queries, but from my understanding FQs
: actually perform another query before the main one and these queries are
: expensive in time and I would like to avoid it if possible.

Unless you actaully see notisable performance problems I wouldn't assume 
it will be an issue -- test first, get it working, then optimize if it's 
too slow.  For most people the overhead of the "fq" won't a factor.  

One option you might consider is the "cache=false" local param which tells 
Solr not to cache the fq (handy if you know the query you are 
filtering on is not going to be reused much) and since it's not being 
cached, Solr will execute it in parallel with the main query and ignore 
anything that it already knows isn't going to matter in the final query.

In your case however, you can already "optimize" the fq solution a bit 
because what you really need to filter out isn't documents matching your 
main query with a score less then zero; that set is the same as the set of 
documents for whom your "eqsim" function returns 0, so you can just use 
*that* in your fq.  Something like this should work...

	q={!edismax ... boost=$eqsim}
	fq={!frange l=0 incl=false v=$eqsim}

...but there may still be ways to clean that up and make it faster 
depending on what exactly your "eqsim" function does (ie: there may be a 
simple query that can be faster then that "frange" to identify the docs 
that get non-zero values from that function.


View raw message