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 Gann Bierner <gb...@gmail.com> on 2016/06/28 19:32:57 UTC

Span boosting and needsScores

Hi all,

I'm trying to get a handle on how boosting is accomplished with span
queries.  In queries when sub weights are created it is done with
explicitly setting needsScores to false.  For example, here is the
implementation in SpanOrQuery:

  @Override
  public SpanWeight createWeight(IndexSearcher searcher, boolean
needsScores) throws IOException {
    List<SpanWeight> subWeights = new ArrayList<>(clauses.size());
    for (SpanQuery q : clauses) {
      subWeights.add(q.createWeight(searcher, false));
    }
    return new SpanOrWeight(searcher, needsScores ?
getTermContexts(subWeights) : null, subWeights);
  }

If the subquery is a SpanBoostQuery, the non-boosted weight is returned and
it appears that the boost is lost.  I do not see any other place where it
would get picked back up again.  There are some hints in jira discussions
that confirms ignoring boosts in span subqueries is intentional.  If so,
could someone please explain the rationale behind this?

Thank you,
Gann