This has been changed in Lucene 2.9, its nothing new in Lucene 4.0. Read the 
changes logs of Lucene 2.9/3.0, there is explained what you need to do.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: u...@thetaphi.de


> -----Original Message-----
> From: saisantoshi [mailto:saisantosh...@gmail.com]
> Sent: Thursday, January 24, 2013 12:19 AM
> To: java-user@lucene.apache.org
> Subject: TopDocCollector vs TopScoreDocCollector (semantics changed in 4.0,
> not backward comptabile)
> 
> Our current search implementation (based on 2.4.0) uses a collector
> extending the TopDocCollector class
> 
> public class MyHitCollector extends TopDocsCollector {
> 
>     private IndexReader indexReader;
>     private CustomFilter customFilter;
> 
>     public MyHitCollector (IndexReader indexReader, int numberOfHits,
> CustomFilter filter) {
>     *    super(numberOfHits);*
>         this.indexReader = indexReader;
>         this.nodeFilter = filter();
>     }
> 
>     *public void collect(int doc, float score) {*
>         try {
>             if (score > 0.0f) {
>                 // do something
>                     super.collect(doc, score);
>                 }
>             }
>         } catch (Exception e) {
> 
>         }
>     }
> 
> 
> //Using the collector
>              MyHitCollector collector;
>              IndexSearcher searcher= new IndexSearcher(reader);
>                try {
>                    collector = new MyHitCollector(reader, maximumHits, 
> filter);
>                     searcher.search(query, null, collector);
>                 } finally {
> 
>                 }
> 
>                 TopDocs docs = collector.topDocs();
> 
> 
> Now in 4.0, the TopDocCollector is removed and the suggested class is to use
> TopScoreDocCollector (for faster performance).. I don't see the following
> signatures available in the newer class thus breaking the backward
> compatibility.
> 
> public collect(int doc, float score).   //I think this is no longer there.
>  super(numberOfHits)  .  //The constructor for this is also been removed in
> 4.0.. This used to be in 2.4
> 
> This looks to be me backward compatibility is broken and there is no proper
> documentation as well.
> 
> Could someone suggest any alternative here? Any collector that we can use
> to be backward compatible?
> 
> Thanks and appreciate your help.
> 
> Thanks,
> Sai.
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/TopDocCollector-vs-
> TopScoreDocCollector-semantics-changed-in-4-0-not-backward-comptabile-
> tp4035806.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
> For additional commands, e-mail: java-user-h...@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to