lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grant Ingersoll <gsing...@apache.org>
Subject Re: How to improve document retrieval speed.
Date Sat, 04 Nov 2006 13:23:20 GMT
You probably can skip the QueryParser part and just construct a  
TermQuery with your term and field.  That will save you a few ticks.   
I'm betting you have just included the code below for example, so  
this may not apply, however, you want to make sure you aren't  
creating the IndexSearcher every time you want to run the query.  See  
the list archives for info on warming/caching the searcher.

What kind of runtimes are you experiencing?

On Nov 4, 2006, at 6:46 AM, Sunil Kumar PK wrote:

> Hi,
>
> In my index there is a unique field, "MY_DOCNO".
>
> If I want get a document from the index with MY_DOCNO=1000,  I am  
> using
> following code,
>
> IndexSearcher isearcher = new IndexSearcher("myindex1");
> QueryParser qp = new QueryParser("MY_DOCNO", new StandardAnalyzer());
>
> Query query = qp.parse("MY_DOCNO:1000");
> Hits hits = isearcher.search(query);
>
> Since I have a unique field in my index, is there any other method,  
> that can
> retrieve the document faster than this?
>
> Thanks,
> Sunil

--------------------------
Grant Ingersoll
Sr. Software Engineer
Center for Natural Language Processing
Syracuse University
335 Hinds Hall
Syracuse, NY 13244
http://www.cnlp.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