Neville Burnell
2006-Nov-22 04:42 UTC
[Ferret-talk] Help with Multiple Readers, 1 Writer scenario
Some time back in September, [sorry to be so slow], Dave wrote:> When you open an IndexReader on the index it is opened up on > that particular version (or state) of the index. So any > operations on the IndexReader (like searches) will only show > what was in the index at the time you opened it. Any modifications > to the index (usually through and IndexWriter) that occur after > you open the IndexReader will not appear in your searches.> So to keep searches up to date you need to close and reopen your > IndexReader every time you commit changes to the index.Would it be possible to enhance IndexReader to report the "version" of the index it is using, and to report if a newer version of the index exists, eg perhaps #version and #current_version? This would allow a long running IndexReader to detect that a new index version is available, which is a problem if the IndexWriter updates the index from another process. For example, I am planning to divide my application into two apps, one which services reader requests, and the other which periodically updates the index if needed. Kind Regards Neville
Neville Burnell
2006-Nov-22 05:28 UTC
[Ferret-talk] Help with Multiple Readers, 1 Writer scenario
Oops, Dave already answered this!> Each version of the index has an internal version number > and there is an IndexReader#latest? method to determine > if the version of the index that you are reading is > the current version.Silly me!> -----Original Message----- > From: Neville Burnell > Sent: Wednesday, 22 November 2006 3:43 PM > To: ''ferret-talk at rubyforge.org'' > Subject: RE: [Ferret-talk] Help with Multiple Readers, 1 > Writer scenario > > Some time back in September, [sorry to be so slow], Dave wrote: > > > When you open an IndexReader on the index it is opened up on that > > particular version (or state) of the index. So any > operations on the > > IndexReader (like searches) will only show what was in the index at > > the time you opened it. Any modifications to the index (usually > > through and IndexWriter) that occur after you open the IndexReader > > will not appear in your searches. > > > So to keep searches up to date you need to close and reopen your > > IndexReader every time you commit changes to the index. > > Would it be possible to enhance IndexReader to report the > "version" of the index it is using, and to report if a newer > version of the index exists, eg perhaps #version and #current_version? > > This would allow a long running IndexReader to detect that a > new index version is available, which is a problem if the > IndexWriter updates the index from another process. For > example, I am planning to divide my application into two > apps, one which services reader requests, and the other which > periodically updates the index if needed. > > Kind Regards > > Neville
Apparently Analagous Threads
- Help with Multiple Readers, 1 Writer scenario
- Error with :create => true and existing index
- Possiible Bug ? indexWriter#doc_count counts deleted docs after #commit
- Possiible Bug ? indexWriter#doc_count countsdeleted docs after #commit
- Index::Index.new vs. Readers and Writers