Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 85113 invoked from network); 20 Jan 2011 13:29:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 20 Jan 2011 13:29:00 -0000 Received: (qmail 39986 invoked by uid 500); 20 Jan 2011 13:28:58 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 39544 invoked by uid 500); 20 Jan 2011 13:28:54 -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 39530 invoked by uid 99); 20 Jan 2011 13:28:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jan 2011 13:28:52 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [85.25.71.29] (HELO mail.troja.net) (85.25.71.29) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 20 Jan 2011 13:28:46 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.troja.net (Postfix) with ESMTP id 691DCD36004 for ; Thu, 20 Jan 2011 14:28:26 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.troja.net Received: from mail.troja.net ([127.0.0.1]) by localhost (megaira.troja.net [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bikEaWa-HZI2 for ; Thu, 20 Jan 2011 14:28:21 +0100 (CET) Received: from VEGA (WDC-MARE.marum.de [134.102.249.78]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.troja.net (Postfix) with ESMTPSA id 09CA2D36003 for ; Thu, 20 Jan 2011 14:28:20 +0100 (CET) From: "Uwe Schindler" To: References: In-Reply-To: Subject: RE: Filter Performance Date: Thu, 20 Jan 2011 14:28:31 +0100 Message-ID: <024401cbb8a5$ee2fb650$ca8f22f0$@thetaphi.de> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AQG+q4DMdXPYPeVlQVhp6kuFwdiSgpPz9Dbg Content-Language: de X-Virus-Checked: Checked by ClamAV on apache.org The reason for this is that the filters and other boolean clauses are applied during result collection. But wildcard query first needs to investigate all terms that match and this is done before the results are collected. And this step takes the time (especially before Lucene 4.0). There is no way to change this. ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@thetaphi.de > -----Original Message----- > From: comparis.ch - Roman Baeriswyl [mailto:roman.baeriswyl@comparis.ch] > Sent: Thursday, January 20, 2011 10:50 AM > To: 'java-user@lucene.apache.org' > Subject: Filter Performance > > Hi all > > I've got an Index with a few 100k documents and I want to run a rather > complex wildcard (incl. leading wildcards) query on it. > The wildcard query takes about 2 seconds to complete. > Now, I want to limit the items on which the wildcard query will be executed. > Let's say, I want to limit the items to those which have the field > "ProductName" set to "milk" (this query itself runs in less than 5 milliseconds > and returns about 100 items). > So, I tried different things but everything resulted in having the exact same > execution time like without this filter. Even if I run the query multiple times > in a row with the same Query and Filter items. > > Here's what I tried: > > - Adding "+ProductName:milk" to the Query > > - Added FieldCacheTermsFilter("ProductName ", new String[] { "milk" }) > as Filter > > - Wrapped the Filter in CachingWrapperFilter > > - Used BooleanQuery filterQuery = new BooleanQuery(); > filterQuery.add(new TermQuery(new Term("ProductName", "milk ")), > BooleanClause.Occur.MUST); and wrapped it with a QueryWrapperFilter and > also tried wrapping it in a FilteredQuery > > Nothing improved the searchspeed, it had always the same speed as when > he parsed thru all documents without any pre-filtering. > > Is this pre-filtering different than I thought? Am I doing something wrong? > Does the index need to be build somehow special for this to work? > > Thanks for your help > //Roman > > ________________________________ > Holen Sie die besten Elektronik-Aktionen direkt auf Ihr Facebook-Profil: > http://www.facebook.com/pages/Preissturz/218831069608 > > Die besten Elektronik-Aktionen auf Twitter: http://twitter.com/preissturz1 --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org