lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1356) Allow easy extensions of TopDocCollector
Date Mon, 18 Aug 2008 06:27:44 GMT


Shai Erera commented on LUCENE-1356:

Re-thinking this - resuableSD should remain private to both TDC and TFDC. The reason is the
two classes use it differently and don't share any implementation which involves this member
(unlike totalHits and hq).

I was in the middle of adding javadoc to the protected members and constructor (which accepts
numHits and PQ) when I noticed that numHits is completely ignored by this constructor -->
TopDocCollector(int numHits, PriortityQueue hq).
The reason is that PQ is be probably configured to hold a maximum number of hits.

What bothers me with this constructor is that it may falsely lead users of the API to think
that it limits their PQ with a maximum number of hits. I think we should remove that parameter
and expose two constructors:
public TopDocCollector(int numHits) AND public TopDocCollector(PriorityQueue hq).

If you agree, I'll reflect that in the 2nd patch I want to create (which adds javadoc).

> Allow easy extensions of TopDocCollector
> ----------------------------------------
>                 Key: LUCENE-1356
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>            Reporter: Shai Erera
>            Assignee: Doron Cohen
>            Priority: Minor
>         Attachments: 1356.patch
> TopDocCollector's members and constructor are declared either private or package visible.
It makes it hard to extend it as if you want to extend it you can reuse its *hq* and *totatlHits*
members, but need to define your own. It also forces you to override getTotalHits() and topDocs().
> By changing its members and constructor (the one that accepts a PQ) to protected, we
allow users to extend it in order to get a different view of 'top docs' (like TopFieldCollector
does), but still enjoy its getTotalHits() and topDocs() method implementations.

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:
For additional commands, e-mail:

View raw message