Have you taken a look at the MemoryIndex? http://lucene.apache.org/java/3_5_0/api/all/index.html See in particular:
> Typically, it is about 10-100 times faster than RAMDirectory. Note that > RAMDirectory has particularly large efficiency overheads for small to > medium sized texts, both in time and space. Indexing a field with N tokens > takes O(N) in the best case, and O(N logN) in the worst case. Memory > consumption is probably larger than for RAMDirectory. > Example throughput of many simple term queries over a single MemoryIndex: > ~500000 queries/sec on a MacBook Pro, jdk 1.5.0_06, server VM. As always, > your mileage may vary. If you have all your queries predefined, this could be a pretty fast way to get where you want to go. Stephen On Tue, Jan 31, 2012 at 10:50 AM, Dave Seltzer <dselt...@tveyes.com> wrote: > Hello, > > > > I’m having a bit of trouble Googling this, so I’m hoping someone can point > me in the right direction. > > > > We have a system which generates blocks of text which need to be searched > as they come in. I was hoping I could use Lucene’s query parser and > analyzer to search a block of text for a series of searches. This example ( > http://javatechniques.com/blog/lucene-in-memory-text-search-example/ ) is > similar to what I want to do, only I’m only interested in searching one > document at a time. > > > > Is my best bet to create an in-memory index, search it, and then throw it > away? Is this fast enough to do a hundred times a second? > > > > Or am I better off using the Highlighter to find out if the document > contains a hit? > > > > Or is there a third, more-awesome, way of doing this? > > > > Thanks much! > > > > -Dave >