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 mcb <th...@gmail.com> on 2012/06/28 00:50:04 UTC

Trying to avoid filtering on score, as I'm told that's bad

I have a function query that returns miles as a score along two points:

q={!func}sub(sum(geodist(OriginCoordinates,39,-105),geodist(DestinationCoordinates,36,-97),Mileage),1000)

The issue that I'm having now now my results give me a list of scores:
*score:10.1 (mi)
score: 20 (mi)
score: 75 (mi)
*
But I would like to also add a clause that cuts off the results after X
miles (say 50) so that 75 above would not be included in the results.
Unfortunately I can't say fq=score:[0 TO 50], but perhaps there is another
way? I'm on solr 4.0

Thanks!

--
View this message in context: http://lucene.472066.n3.nabble.com/Trying-to-avoid-filtering-on-score-as-I-m-told-that-s-bad-tp3991696.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Trying to avoid filtering on score, as I'm told that's bad

Posted by mcb <th...@gmail.com>.
Thanks, this worked using:

&qq={!func}sub(sum(geodist(pt1,30.271567,-97.741886),geodist(pt2,36.054889,-95.716187),product(1.609344,
Dist)), 1000) asc

&sort=$qq

&fq={!frange u=100}$qq


--
View this message in context: http://lucene.472066.n3.nabble.com/Trying-to-avoid-filtering-on-score-as-I-m-told-that-s-bad-tp3991696p3992106.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Trying to avoid filtering on score, as I'm told that's bad

Posted by Yonik Seeley <yo...@lucidimagination.com>.
On Wed, Jun 27, 2012 at 6:50 PM, mcb <th...@gmail.com> wrote:
> I have a function query that returns miles as a score along two points:
>
> q={!func}sub(sum(geodist(OriginCoordinates,39,-105),geodist(DestinationCoordinates,36,-97),Mileage),1000)
>
> The issue that I'm having now now my results give me a list of scores:
> *score:10.1 (mi)
> score: 20 (mi)
> score: 75 (mi)
> *
> But I would like to also add a clause that cuts off the results after X
> miles (say 50) so that 75 above would not be included in the results.
> Unfortunately I can't say fq=score:[0 TO 50], but perhaps there is another
> way? I'm on solr 4.0

If you want to cut off the whole function at 75, then frange can do that:
q={!frange u=75}sub(sum(...

http://lucene.apache.org/solr/api/org/apache/solr/search/FunctionRangeQParserPlugin.html

-Yonik
http://lucidimagination.com