lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven A Rowe <>
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 <>:

	[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():



> -----Original Message-----
> From: andynuss []
> Sent: Monday, June 21, 2010 11:02 AM
> To:
> 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:
> hits-not-returned-until-I-stop-and-restart-application-
> tp911711p911711.html
> Sent from the Lucene - Java Users mailing list archive at
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View raw message