[
https://issues.apache.org/jira/browse/LUCENE-1089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12551227
]
Shai Erera commented on LUCENE-1089:
------------------------------------
1. Actually there was why I removed the minScore. There's no point in
evaluating minScore with current score because it's been evaluated again in
insertWithOverflow. You don't lose anything by just populating reusableSD and
calling insertWithOverflow. For that reason I removed collect() from
TopFieldDocCollector. To me it looks like a cleaner code, and gain, performance
wise, you only make the same comparison twice.
2. That's a good one.
3. Initially I thought TopFieldDocCollector would use it as FieldDoc (which
extends ScoreDoc) and using TopDocCollector's collect() method. Then I
implemented a protected newScoreDoc(doc, score) which was overidden by
TopFieldDocCollector. That way, if TFDC uses TDC's collect() method, all it
needs to do is override newScoreDoc(doc, score) to return a FieldDoc.
4. Initially I implemented top() the same as you did, but then there were tests
that created a PQ of size 0. However, with the change to initialize, it is safe
to do it.
I think that TDC and TFDC as I put them in the patch are extended cleaner and
that way we don't do any extra logic (that's the reason why you would have
needed to write the comment in TFDC's collect() method about simply comparing
the score. Please re-consider my changes.
> Add insertWithOverflow to PriorityQueue
> ---------------------------------------
>
> Key: LUCENE-1089
> URL: https://issues.apache.org/jira/browse/LUCENE-1089
> Project: Lucene - Java
> Issue Type: Improvement
> Affects Versions: 2.3
> Reporter: Shai Erera
> Assignee: Michael McCandless
> Priority: Minor
> Fix For: 2.3
>
> Attachments: LUCENE-1089.take3.patch, PriorityQueue-2.patch,
> PriorityQueue.patch
>
>
> This feature proposes to add an insertWithOverflow to PriorityQueue so that
> callers can reuse the objects that are being dropped off the queue. Also, it
> changes heap to protected for easier extensibility of PQ
--
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]