lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <>
Subject [jira] Commented: (LUCENE-2057) TopDocsCollector should have bounded generic <T extends ScoreDoc>
Date Wed, 11 Nov 2009 21:36:41 GMT


Uwe Schindler commented on LUCENE-2057:

bq. It's strange ... I'd thought that if I declare PQ<T>, and then from TFC for example
init FVHQ, which extends PQ as <Entry>, then all who'll use FVHQ won't need to cast
to Entry. I've tried it and indeed TSDC does not need to case to ScoreDoc, but TFC needs to
case to Entry. 

Because of that it is implemented with a generic type param. This ensures that both the class
implementation and the embedded PQ both work with the same data type and you never have to
cast. The problem with the state before was that Entry did not extend ScoreDoc and because
of that the generics were unbounded.

I'll commit this soon (waiting for the backwards-tests).

> TopDocsCollector should have bounded generic <T extends ScoreDoc>
> -----------------------------------------------------------------
>                 Key: LUCENE-2057
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Shai Erera
>            Assignee: Uwe Schindler
>             Fix For: 3.0
>         Attachments: scoredoc.patch
> TopDocsCollector was changed to be TopDocsCollector<T>. However it has methods
which specifically assume the PQ stores ScoreDoc. Therefore, if someone extends it and defines
a type which is not ScoreDoc, things will break.
> We shouldn't put <T> on TopDocsCollector at all, but rather change its ctor to
*protected TopDocsCollector(PriorityQueue<? extends ScoreDoc> pq)*. TopDocsCollector
should handle ScoreDoc types. If we do this, we'll need to change FieldValueHitQueue's Entry
to extend ScoreDoc as well.

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