This code is example ;-) I already use cache ;-) 

-----Original Message-----
From: Ramana Jelda [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 10, 2006 5:15 PM
To: java-user@lucene.apache.org
Subject: RE: speed 
Importance: High

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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> 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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to