Neville Burnell
2006-Sep-22 06:30 UTC
[Ferret-talk] Error with :create => true and existing index
I implemented a "reindex" command which simply creates an IndexWriter with :create => true for a prexisting index. The "reindexing" seems to start out ok, with several thousand docs added, then Ferret throws an exception: IO Error occured: couldn''t rename file "index\_0.tmp" to "index\_0.cfs": <File exists> I guess that _0.cfs is held open by an IndexReader, so the :create is failing to delete it and hence the rename is failing. Kind Regards Neville
David Balmain
2006-Sep-22 10:46 UTC
[Ferret-talk] Error with :create => true and existing index
On 9/22/06, Neville Burnell <Neville.Burnell at bmsoft.com.au> wrote:> I implemented a "reindex" command which simply creates an IndexWriter > with :create => true for a prexisting index. > > The "reindexing" seems to start out ok, with several thousand docs > added, then Ferret throws an exception: > > IO Error occured: couldn''t rename file "index\_0.tmp" to "index\_0.cfs": > <File exists> > > I guess that _0.cfs is held open by an IndexReader, so the :create is > failing to delete it and hence the rename is failing. > > Kind Regards > > Neville >Hi Neville, Probably a good guess. That is why you need to close your IndexReader when you finish with it. I''m not sure if you are asking for a confirmation that this was the problem or looking for a solution. Let me know if closing all IndexReaders doesn''t fix the error. Cheers, Dave
Neville Burnell
2006-Sep-23 02:05 UTC
[Ferret-talk] Error with :create => true and existing index
> I''m not sure if you are asking for a confirmation that this was the > problem or looking for a solution.I guess I am looking for a solution to rebuilding the index while readers are active. For the time being I could simply delete all docs, then add all docs. Would a IndexWriter.delete_all be possible? Kind Regards Neville
David Balmain
2006-Sep-23 06:54 UTC
[Ferret-talk] Error with :create => true and existing index
On 9/23/06, Neville Burnell <Neville.Burnell at bmsoft.com.au> wrote:> > I''m not sure if you are asking for a confirmation that this was the > > problem or looking for a solution. > > I guess I am looking for a solution to rebuilding the index while > readers are active. > > For the time being I could simply delete all docs, then add all docs. > > Would a IndexWriter.delete_all be possible? > > Kind Regards > > NevilleHi Neville, You could do it like this: reader.max_doc.times {|i| reader.delete(i)} That will delete all documents. Make sure you close your IndexWriter before doing this though as the IndexReader will try and obtain locks on the index for the deletions. Alternatively you could use a rotating index directory. When you rebuild, rebuild in a new directory. Then when you have finished rebuilding, re-open the IndexReaders on the new directory. Both solutions should work equally well. Cheers, Dave
Reasonably Related Threads
- Possiible Bug ? indexWriter#doc_count countsdeleted docs after #commit
- Help with Multiple Readers, 1 Writer scenario
- Possiible Bug ? indexWriter#doc_count counts deleted docs after #commit
- Help with Multiple Readers, 1 Writer scenario
- Ferret 0.11.4.win32 indexing speed vs Ferret 0.10.9.win32