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 Vincent Le Maout <vi...@lingway.com> on 2006/03/24 11:29:12 UTC

span query scoring vs boolean query scoring

Hi everybody,
it's been a while since I try to figure out the difference between the 
scoring of span and boolean
queries with little success. All stems from the observation that the 
boost of SpanTermQuery as
leaves of the query tree does not seem to have much influence on the 
resulting scores of the
documents. Looking into the source code (1.9.1) I found the computing of 
weights to be somewhat
different according to the query type (I am not that comfortable with 
the source code :-)

*org.apache.lucene.search.BooleanQuery.BooleanWeight* :

*public* BooleanWeight(Searcher searcher)
      *throws* IOException {
      *this*.similarity = getSimilarity(searcher);
      *for* (*int* i = 0 ; i < clauses.size(); i++) {
        BooleanClause c = (BooleanClause)clauses.elementAt(i);
        weights.add(c.getQuery().createWeight(searcher));
      }
    }

which looks to me like a recursive descent through the tree, taking in 
account
the weights of all the nodes, whereas :

*org.apache.lucene.search.spans.SpanWeight* :

*public* SpanWeight(SpanQuery query, Searcher searcher)
    *throws* IOException {
    *this*.similarity = query.getSimilarity(searcher);
    *this*.query = query;
    *this*.terms = query.getTerms();

    idf = *this*.query.getSimilarity(searcher).idf(terms, searcher);
  }

lacks any traversal and according to what I have understood so far from 
the rest
of the code, only takes in account the boost of the tree root in 
SumOfSquareWeights,
which is consistent with the resulting scores not considering the boost 
of my tree
leaves.
I am missing something ? Is it intented or is it a bug ?

Thanks in advance.
Regards.

Vincent



Re: span query scoring vs boolean query scoring

Posted by Doug Cutting <cu...@apache.org>.
Vincent Le Maout wrote:
> I am missing something ? Is it intented or is it a bug ?

Looks like a bug.  Can you please submit a bug report, and, ideally, 
attach a patch?

Thanks,

Doug

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


Re: span query scoring vs boolean query scoring

Posted by Doug Cutting <cu...@apache.org>.
Vincent Le Maout wrote:
> I am missing something ? Is it intented or is it a bug ?

Looks like a bug.  Can you submit a patch?

Doug

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


Re: span query scoring vs boolean query scoring

Posted by Chris Hostetter <ho...@fucit.org>.
: *public* SpanWeight(SpanQuery query, Searcher searcher)
:     *throws* IOException {
:     *this*.similarity = query.getSimilarity(searcher);
:     *this*.query = query;
:     *this*.terms = query.getTerms();
:
:     idf = *this*.query.getSimilarity(searcher).idf(terms, searcher);
:   }
:
: lacks any traversal and according to what I have understood so far from
: the rest
: of the code, only takes in account the boost of the tree root in
: SumOfSquareWeights,

well, getTerms for all of the SpanQueris does traverse the terms of the
nested span queries, so the idf does take into account the whole structure
... but i think you're right about the boost -- it doesn't look like the
boost of nested SpanQueries are ever used.

: I am missing something ? Is it intented or is it a bug ?

that i can't answer ... if it is intended, it should probably be
documented.


-Hoss


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