You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Sunil Kumar PK <pk...@gmail.com> on 2006/11/04 12:46:28 UTC

How to improve document retrieval speed.

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

Re: How to improve document retrieval speed.

Posted by Sunil Kumar PK <pk...@gmail.com>.
Hi,

I am using Lucene's Remote Parallel Multisearcher with 10 nodes in my search
cluster having 200+ distributed index fragments (1 Index fragment = 4GB). I
have 30+ fields in my index, and I am storing a master XML file (contains 5
to 30 pages of information) in one field. I also  have two web servers
behind a load-balancer.

My system works as follows.

I) When the user search for a document, the search result page will display
3 stored fields from the index (Document Number,Title and Date).

II) On clicking a particular result I am searching again(Since I am using a
load-balancer I can't use the same RemoteSearchable object) for that
particular 'document number' and retrieve the stored master XML from the
index.

The first step is ok with me, but I want to improve the speed in the second
part. Is it necessary to do the scoring and weight calculation in the second
step?

Thanks,
Sunil

On 11/4/06, Grant Ingersoll <gs...@apache.org> wrote:
>
> 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
>
>

Re: How to improve document retrieval speed.

Posted by Grant Ingersoll <gs...@apache.org>.
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