The behavior is correct.  At least with Lucene.Net 2.3.1, see 
IndexReader.IsCurrent() and IndexReader.Reopen().


-----Original Message-----
From: Rob Vesse [mailto:[email protected]] 
Sent: Wednesday, February 08, 2012 7:54 PM
To: [email protected]
Subject: [Lucene.Net] Problems with IndexSearcher

Hi All


I'm having an issue with IndexSearcher which I'm confused by, this may just be 
that I don't fully understand all the intricacies of how Lucene works or it may 
be a bug I really have no idea but I'd appreciate it if someone could enlighten 
me.


My problem boils down to inconsistent behavior of the IndexSearcher, if I 
create it and then subsequently make changes to the index it is unable to see 
those changes even if I have called commit() on the IndexWriter used to make 
changes.


e.g.


//Load Index

//Create Searcher

//Modify Index and Commit

//PROBLEM - Searcher cannot see changes


However if I create it after I've committed the changes then it can see those 
changes fine.


e.g.


//Load Index

//Modify Index and Commit

//Create Searcher

//OK - Searcher sees changes fine


So is this the expected behavior of an IndexSearcher or is it a bug?


If it is expected behavior is there some workaround i.e. some method I can 
call that ensures that it always see's changes to the index as soon as they 
are committed or am I literally forced to recreate my IndexSearcher every 
time I change my index.  This seems kinda dumb so I feel like I've maybe 
missed something here and I'm just using the code wrong?


Any guidance would be much appreciated


Cheers,


Rob




Reply via email to