Re: 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

On 9/23/06, Neville B. [email protected] wrote:

Kind Regards

Neville

Hi 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