lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Che Dong" <>
Subject How to access cached hits in multi thread applications?
Date Wed, 27 Feb 2002 11:08:06 GMT
Hi all:
is it safe to let multiple threads search concurrently using the same
This problem was discussed in the middle of last year.

Doug said:
No, I don't think there has ever been a problem with this.

The problems are only when you add documents, and then search with an
IndexReader created before the additions were made.


What did Doug mean?
No: it's no problem let multiple threads search concurrently using the same
No: its not safe?

but if IndexSearcher can't use in multi thread concurrently the hits cache
only useful for single thread apps.

Let me see a multiple app sample: a search engine SearchServlet
String searchDir = "/path/to/lucene/index";
IndexSearcher sh = new IndexSearcher(searchDir);
//actually wrapper with new Hits(IndexSearcher sh,Query qry,Filter flt);
Hits hs =;
//hits read 100 docs into cache by default
//show hits from 10 - 20

if each servlet/jsp construct IndexerSearcher every time, all hits was lost
after IndexSearcher.close(). seem cached 100 hits is no use outside this

I hope the search results hits can specify cache size and reuse in other


Che Dong

Do You Yahoo!?
Get your free address at

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message