lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tri Cao <>
Subject Re: custom scoring
Date Mon, 09 Apr 2012 05:49:40 GMT

After reading through the IndexSearcher code, it seems I have to do the following:

- implement a custom Collector to collect not just the doc IDs and score, but the fields I
care about as well
- extend ScoreDoc to hold the extra fields
- when I get back a TopDocs from a search() call, I can go through the TopDocs and apply the
constraints I need to

I think this will work, but have some concern about performance. What would you think?


On Apr 06, 2012, at 10:06 AM, Tri Cao <> wrote:

Hi all,

What would be the best approach for a custom scoring that requires a "global" view of the
result set. For example, I have a field call "color" and I would like to have constraints
that there are at most 3 docs with color:red, 4 docs with color:blue in the first 16 hits.
And the items should still be sorted in by their relevance scores after the constraints are



  • Unnamed multipart/alternative (inline, None, 0 bytes)
    • Unnamed multipart/related (inline, None, 0 bytes)
View raw message