Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B53E69BBD for ; Tue, 31 Jan 2012 22:06:05 +0000 (UTC) Received: (qmail 12639 invoked by uid 500); 31 Jan 2012 22:06:03 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 12574 invoked by uid 500); 31 Jan 2012 22:06:02 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 12566 invoked by uid 99); 31 Jan 2012 22:06:02 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 22:06:02 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.214.176] (HELO mail-tul01m020-f176.google.com) (209.85.214.176) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jan 2012 22:05:57 +0000 Received: by obbwd18 with SMTP id wd18so813856obb.35 for ; Tue, 31 Jan 2012 14:05:36 -0800 (PST) Received: by 10.182.8.66 with SMTP id p2mr2964625oba.0.1328047536549; Tue, 31 Jan 2012 14:05:36 -0800 (PST) From: Dave Seltzer References: In-Reply-To: MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AczgMWwvis/k6RORRiuPhZc+J8mEKgAMiQAw Date: Tue, 31 Jan 2012 17:05:36 -0500 Message-ID: <732cab5e687c8a4689e3fa8cfd98c2ea@mail.gmail.com> Subject: RE: Searching a string using lucene To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Hi Stephen, That is precisely what I was looking for! Thanks very much! -Dave -----Original Message----- From: Stephen Howe [mailto:] Sent: Tuesday, January 31, 2012 11:00 AM 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 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-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org