lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramana Jelda" <ramana.je...@ciao-group.com>
Subject RE: speed
Date Fri, 10 Mar 2006 14:14:59 GMT
Hi,
You are opening IndexSearcher for each and every search request, which is
not adviasable.

Cache IndexSearcher or IndexReader.. This will surely improve your speed .

Greetings,
 

> -----Original Message-----
> From: anton@orbita1.ru [mailto:anton@orbita1.ru] 
> Sent: Friday, March 10, 2006 3:11 PM
> To: java-user@lucene.apache.org
> Subject: RE: speed 
> 
> Forget.... ;-)  I use 32-bit platform (Fedora Core release 
> 3), 1 GB RAM, Celeron 2.40GHz. 
> 
> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: Friday, March 10, 2006 4:33 PM
> To: java-user@lucene.apache.org
> Subject: Re: speed
> Importance: High
> 
> 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
> 
> 
> 
> 
> ---------------------------------------------------------------------
> 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