lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LUCENE-2057) TopDocsCollector should not be declared with generic <T>
Date Wed, 11 Nov 2009 19:54:39 GMT

    [ https://issues.apache.org/jira/browse/LUCENE-2057?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12776618#action_12776618
] 

Uwe Schindler commented on LUCENE-2057:
---------------------------------------

The generics should in all cases put on top of the whole class, because it is a wrapper around
PQ. And PQ needs a generic type. By using a ?-like type you have to still cast in all sub-classes.
See also other classes in oal.search (MultTermQueryWrapperFilter and so on).

> TopDocsCollector should not be declared with generic <T>
> --------------------------------------------------------
>
>                 Key: LUCENE-2057
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2057
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Shai Erera
>             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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org


Mime
View raw message