Oh, boy, what a mistake. I thought I was being clever by creating a Directory object. All that did was prevent the writer from ever quite flushing because I wasn't closing THAT.
-----Original Message----- From: Erick Erickson [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 10, 2007 5:22 PM To: java-user@lucene.apache.org Subject: Re: isCurrent says no, but contents still invisible And don't forget that you need to close and re-open the reader to pick up the changes....... [EMAIL PROTECTED] <G>. On 1/10/07, Benson Margulies <[EMAIL PROTECTED]> wrote: > > #2 is a possible issue. I stared at the code some more: > > The test case adds up to : > > Create all the objects. > > Add three docs. > Add a fourth doc. > > Do a query aimed at the fourth doc. > > isCurrent() returns false. > > Close reader/searcher, open reader/searcher, numDocs() in the reader > returns 3. Not 4. > > However, reading your message carefully, I realize that I'm probably > fundamentally misguided. There's no flush() API on a writer, so, of > course, the only possible way for a reader to see current contents is if > the writer gets closed and reopened. I keep trying to cook up some > scheme in which this is not true, but, with the stock classes, it now > seems self-evident to me that it has to be true. > > I'll put in the requisite code, and slink away. > > > -----Original Message----- > From: Doron Cohen [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 10, 2007 4:07 PM > To: java-user@lucene.apache.org > Subject: Re: isCurrent says no, but contents still invisible > > That's strange. Since you don't close the writer usually adding the doc > would not modify the index (unless adding the doc triggered a merge). > > You may want to check that: > 1. writer and reader really opened against the same path; > 2. reader isCurrent state also before adding the doc and after > re-opening; > 3. searched terms vs. added terms - might not be related to concurrency > at > all. > > Finally perhaps post here the code so people can take a look. > > "Benson Margulies" <[EMAIL PROTECTED]> wrote on 10/01/2007 12:45:08: > > > I'm trying what should be the dumbest possible example of concurrency > > management with 2.0 in Java with an ordinary FSDirectory. > > > > > > > > I create an IndexWriter from a pathname, an IndexReader from the same > > pathname, and an IndexSearcher from the reader. > > > > > > > > I add one document. > > > > > > > > I call isCurrent() on the reader. It says, 'false'. > > > > > > > > So, I close the reader and the searcher, and I create a new reader and > a > > new searcher. I search for the document, and I don't find it. > > > > > > > > I must be missing something simple. > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]