MemoryIndex only allows *one* document! So it is mostly for lookup if a term is contained in a document and where (used internally by the highlighter).
----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: u...@thetaphi.de > -----Original Message----- > From: Stephen Howe [mailto:silentgun...@gmail.com] > Sent: Tuesday, January 31, 2012 5:00 PM > To: java-user@lucene.apache.org > Subject: Re: Searching a string using lucene > > 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 > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org