lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: speed
Date Fri, 10 Mar 2006 13:32:38 GMT
I'm curious, how many documents in your index and what kind of  
queries are you issuing?   Even 1.6 seconds is a LONG time for a  
search in most Lucene indexes.

	Erik


On Mar 10, 2006, at 5:38 AM, Anton Potehin wrote:

> I try 2 way for get count results:
>
> 1)
> Query q = ....
> IndexSearcher is = ....
> int count = Is.search(q).length();
>
> 2)
> Query q = ....
> IndexSearcher is = ....
> CountCollector collector = new CountCollector();
> Is.search(q, collector);
> Int count = collector.getCount();
>
> First way return results for 1.644 sec.
> Second way return results fot 3.088 sec.
> Why first way faster then second?
> Can I accelerate it? And how? Can you offer any ways for get number of
> results?
>
>
> ----------------------CountCollector
> import org.apache.lucene.search.HitCollector;
>
> /**
>  * @author Anton Potekhin
>  * @date: 03.03.2006 17:28:03
>  */
> public class CountCollector extends HitCollector {
>
>     private int numberRusults = 0;
>     public int getCount() {
>         return numberRusults;
>     }
>
>     public CountCollector() {
>
>     }
>
>     public void collect(int doc, float score) {
>         if (score > 0.0f) {
>             numberRusults++;
>         }
>     }
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


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


Mime
View raw message