You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by marquinhocb <ma...@hotmail.com> on 2009/09/01 08:24:18 UTC

Score for query-generated value

I would like to create a scorer that applies a score based on a value that is
calculated during a query.  More specifically, to apply a score based on
geographical distance from a latitude,longitude.

What is the easiest way to go about doing this?  The LocalLucene contrib
uses a SortComparatorSource, but I would like to, if possible, use the
scoring mechanism so that distance is scored just like all other fields,
thus allowing for searches which give more/less weight to distance (and for
example, more weight to a closer-matching search term).

Are there any good examples of how to do this? Or can someone point me in
the right direction?

Ideally I would create a CustomScoreQuery (instead of a ConstantScoreQuery)
that would take in a filter that would automatically give matching documents
a score, but I don't see a straight-forward way of doing this.
-- 
View this message in context: http://www.nabble.com/Score-for-query-generated-value-tp25234966p25234966.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Score for query-generated value

Posted by Michael McCandless <lu...@mikemccandless.com>.
Function queries should work here? (org.apache.lucene.search.function.*).

Mike

On Tue, Sep 1, 2009 at 2:24 AM, marquinhocb<ma...@hotmail.com> wrote:
>
> I would like to create a scorer that applies a score based on a value that is
> calculated during a query.  More specifically, to apply a score based on
> geographical distance from a latitude,longitude.
>
> What is the easiest way to go about doing this?  The LocalLucene contrib
> uses a SortComparatorSource, but I would like to, if possible, use the
> scoring mechanism so that distance is scored just like all other fields,
> thus allowing for searches which give more/less weight to distance (and for
> example, more weight to a closer-matching search term).
>
> Are there any good examples of how to do this? Or can someone point me in
> the right direction?
>
> Ideally I would create a CustomScoreQuery (instead of a ConstantScoreQuery)
> that would take in a filter that would automatically give matching documents
> a score, but I don't see a straight-forward way of doing this.
> --
> View this message in context: http://www.nabble.com/Score-for-query-generated-value-tp25234966p25234966.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org