
markrmiller at gmail
Nov 29, 2006, 2:56 PM
Post #6 of 7
(1404 views)
Permalink
|
|
Re: Cached Hits / closing IndexSearcher after add/delete w/IndexModifier
[In reply to]
|
|
If you haven't seen the following option you might want to check it out. It uses reference counting to keep track of writers/searchers/etc(I think solr does as well). Has worked great for everything I have thrown at it other than need some tweaks to its multisearcher support. Also is a good base for adding the ability to 'warm' searchers. The oversimplified gist is: When a writer is closed, new searchers are opened for the index. BEGIN QUOTE: You can download the source here: http://www.blizzy.de/lucene/lucene-indexaccess-0.1.0.zip Using LuceneIndexAccessor is incredibly simple: Directory directory = ... Analyzer analyzer = ... // somewhere near program start IIndexAccessProvider accessProvider = new IndexAccessProvider(directory, analyzer); ILuceneIndexAccessor accessor = new LuceneIndexAccessor(accessProvider); accessor.open(); IndexWriter writer = null; try { writer = accessor.getWriter(); // use writer... } catch (IOException e) { // ... } finally { accessor.release(write); } // somewhere near program exit accessor.close(); Eric Brown wrote: > Hi Yonik, > > On Nov 29, 2006, at 11:16 AM, Yonik Seeley wrote: >> On 11/29/06, Eric Brown <yogieric.dev [at] gmail> wrote: > [snip] >>> Also, should I keep one IndexModifier open for the life of my service/ >>> application or should I open and close it when I get new requests to >>> add or remove documents? (I don't really have control over batching >>> unfortunately -- though I've certainly pointed it out.) >> >> IndexModifier currently has very low performance with mixed adds and >> deletes. >> You can keep the same one over the lifetime of the app though. > > Assuming I call flush() after every operation (they won't be that > frequent), if I don't call close() when my application shuts down, > will I run into locking issues when I restart my application? > >> If you haven't seen it, another alternative that might fit your needs >> is Solr. > > I just took a look. It looks very applicable and I'll look at it > seriously for subsequent roll-outs of our site. For the short-term I'm > too tight for time to change direction. > > Thanks! > Eric > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe [at] lucene > For additional commands, e-mail: java-user-help [at] lucene > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe [at] lucene For additional commands, e-mail: java-user-help [at] lucene
|