lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martijn v Groningen <>
Subject Re: Grouping - Boosting large groups
Date Tue, 12 Jun 2012 18:51:17 GMT
Hi Corwin,

This not yet possible out of the box. However I think it is possible:
1) Create a Lucene collector that counts for all groups the number of
document that match. This collector will basically compute a map with
the group value as key and a count as value
2) Run this collector as an extra phase before you run the
3) Use BoostedQuery with a custom value source. The custom value
source can emit a boost value per document (via FunctionValues) and in
this case you base it on the document count
    from the group to document count map computed in step 1.

Note: This approach is more expensive then what you are doing now. It
requires another extra search.
Note: The approach assumes lucene 4.0 (which isn't released), but
should be possible with lucene 3.6 (I think)

Make an issue in Jira about this if you start working on it. This and
similar group properties based sorting / boosting are much needed


On 11 June 2012 18:10, corwin <> wrote:
> Hi forum,
> I've implemented grouping using the TermFirstPassGroupingCollector and
> TermSecondPassGroupingCollector, pretty much exactly as the example at the
> API. This works really well. I'm getting a the groups sorted by the computed
> relevance, within each groups the docs are sorted by a numeric field. So
> far, so good.
> Now I want to make things more complicated by boosting larger groups in
> addition to the existing relevance sort. For example, if the first result
> has a relevancy score of 1 and the group has 2 docs and the second group has
> a score of 0.9 and 4 docs, I want to boost the second group so it will
> appear before the first.
> Basically I'm trying to boost the groups according to the number of elements
> in the groups.
> I couldn't figure out how to do that or find an example anywhere.
> I hope I'm making sense
> Thanks in advance.
> --
> View this message in context:
> Sent from the Lucene - Java Developer mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

Met vriendelijke groet,

Martijn van Groningen

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message