Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 27459 invoked from network); 23 Oct 2010 22:44:48 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Oct 2010 22:44:48 -0000 Received: (qmail 7026 invoked by uid 500); 23 Oct 2010 22:44:47 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 6978 invoked by uid 500); 23 Oct 2010 22:44:47 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 6971 invoked by uid 99); 23 Oct 2010 22:44:47 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 23 Oct 2010 22:44:47 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=FREEMAIL_FROM,SPF_NEUTRAL,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [217.146.183.191] (HELO nm17.bullet.mail.ukl.yahoo.com) (217.146.183.191) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 23 Oct 2010 22:44:37 +0000 Received: from [217.146.183.184] by nm17.bullet.mail.ukl.yahoo.com with NNFMP; 23 Oct 2010 22:44:16 -0000 Received: from [217.146.183.172] by tm15.bullet.mail.ukl.yahoo.com with NNFMP; 23 Oct 2010 22:44:15 -0000 Received: from [127.0.0.1] by omp1013.mail.ukl.yahoo.com with NNFMP; 23 Oct 2010 22:44:15 -0000 X-Yahoo-Newman-Id: 715943.4727.bm@omp1013.mail.ukl.yahoo.com Received: (qmail 86078 invoked from network); 23 Oct 2010 22:44:15 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=DKIM-Signature:Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=BuY3SdrcQa10DruXg1VPDR2XigRAs7IxyOTnrbh+KmPJtBjmzyMoaJb6+w/FHYit1ARcCza2fna4I02LaFQ2aQ8wDNkPOea1sVn8nKUHbW13jW5jWwOus5GGxfiM9eIXtPqiWzuXSK6BPt00slfRvM6L3x7DNB8e9lV9p/wcarU= ; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s1024; t=1287873855; bh=PGKxnGwSRIuV7ExbkB6wT+8y3ucHkuQ8D0FcBLa2dAw=; h=Received:X-Yahoo-SMTP:X-YMail-OSG:X-Yahoo-Newman-Property:Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Content-Transfer-Encoding:Message-Id:References:To:X-Mailer; b=gqJw6EKPrO0R/DuKn5SDB/QJZ7k2gj3pdwm6d1K65WA00sSQGBVe9BS9aK4wjTPZO/ZYZ7vsCTQamcrCY9bVWZjtR23fWv8j5czldyIfHXij66m7U/8w3nqYTjjuphLdznhAZjJ9zkffq7Yi7cydbxhI6QYzTdc6bzRgEKEqRUw= Received: from [192.168.1.108] (markharw00d@194.106.34.5 with plain) by smtp136.mail.ukl.yahoo.com with SMTP; 23 Oct 2010 22:44:15 +0000 GMT X-Yahoo-SMTP: rdTGKYaswBBzjeOz17cOw.4gNsDMDjs6 X-YMail-OSG: WTZw_JEVM1mwUQB888yLH1hucUa6LSqpZkcGlci9kmiDQDs sSa2fFpkr7LtpODu0ZKWvl_cVcvR3YrF06_7oM.az242jkjv8XbZRqor43LG NRe0pGfsWS6lLN1EeBE_UzH_ylv6TWiDv4K1U08Lhr05iuDJgmwmwg2SiNkv ZsLaRlTcZPoT0EdN0KgIr.cRfq_Wubm43eqthF5wStIZ8dWRejaUFSRkfJeo ip1c0IJZrkzaHYhFX6hzJTASzwu27 X-Yahoo-Newman-Property: ymail-3 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1081) Subject: Re: Using filters to speed up queries From: Mark Harwood In-Reply-To: Date: Sat, 23 Oct 2010 23:44:15 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: dev@lucene.apache.org X-Mailer: Apple Mail (2.1081) X-Virus-Checked: Checked by ClamAV on apache.org Look at BooleanQuery with 2 "must" clauses - one for the query, one for = a ConstantScoreQuery wrapping the filter. BooleanQuery should then use automatically use skips when reading = matching docs from the main query and skip to the next docs identified = by the filter. Give it a try, otherwise you may be looking at using separate indexes On 23 Oct 2010, at 23:18, Khash Sajadi wrote: > My index contains documents for different users. Each document has the = user id as a field on it. >=20 > There are about 500 different users with 3 million documents. >=20 > Currently I'm calling Search with the query (parsed from user) and = FieldCacheTermsFilter for the user id. >=20 > It works but the performance is not great. >=20 > Ideally, I would like to perform the search only on the documents that = are relevant, this should make it much faster. However, it seems = Search(Query, Filter) runs the query first and then applies the filter. >=20 > Is there a way to improve this? (i.e. run the query only on a subset = of documents) >=20 > Thanks --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org