lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <sar...@syr.edu>
Subject RE: search hits not returned until I stop and restart application
Date Mon, 21 Jun 2010 15:11:05 GMT
Hi Andy,

From the API docs for IndexWriter <http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/index/IndexWriter.html>:

	[D]ocuments are added with addDocument and removed
	with deleteDocuments(Term) or deleteDocuments(Query).
	A document can be updated with updateDocument (which
	just deletes and then adds the entire document).
	When finished adding, deleting and updating documents, 
	close should be called.

	These changes .... are not visible to IndexReader
	until either commit() or close() is called.

So you gotta call commit() or close().  Once you've done that, you can reduce the (expensive)
cost of opening a new IndexReader by calling reopen():

<http://lucene.apache.org/java/3_0_2/api/all/org/apache/lucene/index/IndexReader.html#reopen%28%29>

Steve

> -----Original Message-----
> From: andynuss [mailto:andrew_nuss@yahoo.com]
> Sent: Monday, June 21, 2010 11:02 AM
> To: java-user@lucene.apache.org
> Subject: search hits not returned until I stop and restart application
> 
> 
> Hi,
> 
> I have an IndexWriter singleton in my program, and an IndexSearcher
> singleton based on a readonly IndexReader singleton.  When I use the
> IndexWriter to index a large document to lucene, and then, while the
> program is still running, use my previously created IndexSearcher to find
> hits in that book, they are not found.  But if I stop and restart the
> application, then they are found.
> 
> Andy
> --
> View this message in context: http://lucene.472066.n3.nabble.com/search-
> hits-not-returned-until-I-stop-and-restart-application-
> tp911711p911711.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> 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