lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Che Dong" <ched...@yahoo.com>
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
IndexSearcher?
http://www.geocrawler.com/archives/3/2624/2001/6/0/5921366/
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.

Doug

What did Doug mean?
No: it's no problem let multiple threads search concurrently using the same
IndexSearcher?
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 = sh.search(qry);
//hits read 100 docs into cache by default
//show hits from 10 - 20
....
search.close();

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

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

Regards

Che Dong






_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>


Mime
View raw message