On 5/30/06, Tom Davies <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have some code to rebuild my ferret indexes but occasionally some
> stale documents remain in the index even after rebuilding. The only
> way I could find around this is to manually delete the index files
> from the filesystem. Here is the code I have for rebuilding one of my
> indexes for Gifts:
>
> # delete existing entries
> INDEX.size.times {|i| INDEX.delete(i)}
>
> gifts = Gift.find(:all)
> if (gifts)
> gifts.each do |e|
> INDEX << self.to_doc
> end
> end
> INDEX.flush()
>
> Does this look ok? I have verified this behavior on Ferret 0.3.2 and
> 0.9 on windows.
Hi Tom,
This looks fine. Personally, I would just reopen the index with
:create => true rather than deleting all the documents but it should
still work. I have no idea why stale documents would be remaining in
the index. Do you have more than one process writing to the index? Can
you narrow this behaviour down to a simple test case?
Cheers,
Dave
_______________________________________________
Ferret-talk mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/ferret-talk