lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eran Sevi <>
Subject Re: score from spans
Date Sun, 09 Aug 2009 09:10:34 GMT
Thanks for the answer.

I tried to further understand the weight and score mechanism when running a
span query search.
I noticed that indeed the SpanScorer and SpanWeight are being called and
some score is returned but it seems to me that these basic implementations
are more appropriate for the basic SpanTermQuery.
For the other types of span queries, the inner queries scores and weights
are not taken into account - for example if I run a simple SpanOrQuery and
boost one of it's child SpanTermQuery, the boost is not taken into account.

It seems to me that some recursive calculation is required in order to take
into account all the weights and scores of the span's sub queries.
I'm trying to come up with a correct implementation for SpanOrQuery,
SpanNearQuery, SpanNotQuery based on similiar calculations of BooleanQuery.

Do you have a better idea on how to achieve the correct scoring? the score
calculations are quite complex for each case of span queries so any help is

Thanks, Eran.

On Tue, Aug 4, 2009 at 8:51 PM, Grant Ingersoll <> wrote:

> A SpanQuery is a Query, so if you do a search for it, you will get scores.
>  However, the mechanism is a bit complicated, b/c actually getting the Spans
> is separate from doing the query.  I agree there could be tighter
> integration.  However, what you could do is use Spans.skipTo to move to the
> document you are examining in the search results.
> -Grant
> On Aug 2, 2009, at 11:30 AM, Eran Sevi wrote:
> Hi,
>> How can I get the score of a span that is the result of
>> SpanQuery.getSpans()
>> ? The score should can be the same for each document, but if it's unique
>> per
>> span, it's even better.
>> I tried looking for a way to expose this functionality through the Spans
>> class but it looks too complicated.
>> I'm not even sure that by default some score calculation is even performed
>> when using span queries.
>> I've noticed that some calculations are made using payloads and
>> BoostingTermQuery but the score result is used internally and can't be
>> accessed from the Spans results.
>> I don't want to re-run the query again using a HitCollector and since the
>> reader is passed to getSpans, I think it should be possible to do what I
>> want.
>> Any help on the correct way to expose the span score will be appreciated.
>> Thanks,
>> Eran.
> --------------------------
> Grant Ingersoll
> Search the Lucene ecosystem (Lucene/Solr/Nutch/Mahout/Tika/Droids) using
> Solr/Lucene:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message