Hi Vadim,
A Weight is the specialization of a query for a given index reader. It has
access to index statistics that will help compute scores for instance.
A Scorer is the specialization of a weight for a given segment. It can
iterate over matches and compute scores.
The cost of a scorer is the expected number of matching documents for this
scorer. It is useful in order to run operations in the optimal order
Your observation of the behaviour of your BooleanQuery with SHOULD clauses
looks wrong: the score of the boolean query is the sum of the scores of the
matching sub queries.
Le jeu. 30 nov. 2017 à 16:39, Vadim Gindin <vgindin@detectum.com> a écrit :
> Hi
>
> 1) What is the principal difference between COST vs SCORE vs WEIGHT
>
> 2) Assume we have BooleanQuery with 5 TermQuery subqueries that are
> included via SHOULD condition. Assume we have 5 fields and one subquery is
> need to search in one field. Some product of MultiFieldQueryParser. In this
> case the score of BooleanQuery is the sum of scores of each subquery. I
> expected that not all subqueries will be included but only those who
> founded something, but in fact there is a sum of all subqueries. Why? How
> to implement need logic: sum of those subqueries that found something? How
> to check that?
>
> Regards,
> Vadim Gindin
>
