[ 
https://issues.apache.org/jira/browse/LUCENE-533?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12742249#action_12742249
 ] 

Paul Elschot commented on LUCENE-533:
-------------------------------------

I see I missed the introduction of payloads into Spans. As back compat is 
broken anyway, one might as well get rid of the Spans interface completely and 
make Spans an abstract class.
Since it is only the interface that is in the way of changes, any way to get 
rid of the Spans as an interface is ok with me.

Payloads can be yet another way to introduce a (term/spans) weight, so one 
might subclass these from WeightedSpans:
Spans -> WeightedSpans -> PayloadSpans.
That would also allow to use WeightedSpans inside an object hierarchy for 
scoring nested span queries, and to use PayloadSpans as a leafs.

Scoring nested span queries is not trivial, and allowing a weight on each spans 
does not make it simpler, but at least it would allow span queries to behave 
more like boolean queries.

> SpanQuery scoring: SpanWeight lacks a recursive traversal of the query tree
> ---------------------------------------------------------------------------
>
>                 Key: LUCENE-533
>                 URL: https://issues.apache.org/jira/browse/LUCENE-533
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 1.9
>            Reporter: Vincent Le Maout
>            Priority: Minor
>
> I found the computing of weights to be somewhat different according to the 
> query type (BooleanQuery versus SpanQuery) :
> 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 like a recursive descent through the tree, taking into 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 into account the boost of the tree root in 
> SumOfSquareWeights(),
> which is consistent with the resulting scores not considering the boost of 
> the tree
> leaves.
> vintz

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-dev-h...@lucene.apache.org

Reply via email to