You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Paul Waite <pa...@waite.net.nz> on 2006/07/26 23:04:35 UTC

Filter updating

I was wondering if there was a nice way to add documents to a cached filter
'manually' as it were.

The reason would be to avoid a complete refresh of the filter, if you
already knew the docids of the extra documents to add.

An example would be if I had a filter based on datetime, which contained
all documents since a recent fixed timestamp. Then as each new document
arrived, and was indexed it could be simply added to the filter quickly,
instead of having to rebuild it from scratch each time.

Cheers,
Paul.

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: Filter updating

Posted by Erick Erickson <er...@gmail.com>.
Well, I *suppose* you could get the bitset from the pre-existing filter,
copy it to the bitset for your new filter, and play with the bits at the
end. I'm not sure how you get rid of your original filter if you use
CachingWrapperFilter though.........

But.... As "the guys" have pointed out in other contexts, be really sure
your doc IDs don't change out from under you. You can only count on this if
you never, Never, NEVER delete anything from the index and then add
something else between the times you build the first filter and the time you
modify it (at least I think I have this right).

That said, I wouldn't go down this route unless you have an actual,
real-live performance issue to deal with. Premature optimization being the
root of many, many, many evils. It'd be evil to debug if you mess up your
filter copying/modification.....

Best
Erick