Return-Path: Delivered-To: apmail-lucene-solr-user-archive@minotaur.apache.org Received: (qmail 13350 invoked from network); 8 May 2010 03:19:00 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 May 2010 03:19:00 -0000 Received: (qmail 21084 invoked by uid 500); 8 May 2010 03:18:57 -0000 Delivered-To: apmail-lucene-solr-user-archive@lucene.apache.org Received: (qmail 21052 invoked by uid 500); 8 May 2010 03:18:57 -0000 Mailing-List: contact solr-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: solr-user@lucene.apache.org Delivered-To: mailing list solr-user@lucene.apache.org Received: (qmail 21043 invoked by uid 99); 8 May 2010 03:18:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 May 2010 03:18:56 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of goksron@gmail.com designates 209.85.221.191 as permitted sender) Received: from [209.85.221.191] (HELO mail-qy0-f191.google.com) (209.85.221.191) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 08 May 2010 03:18:49 +0000 Received: by qyk29 with SMTP id 29so2776607qyk.14 for ; Fri, 07 May 2010 20:18:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=xgIPvTmZ4RH2YaaFggx8PCoqit3Y/pOZr220I1huCjU=; b=PHVTWemJtRQG9bI+EK7yH971n+2eomoTCGBbtzKYEs8Jd7F5VobdwA6EVl4sND3dIa 4XskEJM7iyV1201KUHf9iN3MVrU0sgXx9rr7w8ly2eho7pXs+Ptdbsl8k/I/Zc0/NPtg n8kxsYlvKD28Er3K3y5XJjswIRqdHoRh1/Hv4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=rrwrTGjE0oJ/tdBBsQ1dJprPvnpTUesTbrQyW2s4xEg5GM7FY8Mzf8FxQPz/UoCkSl PD+0lk7jcnjLSk0sNMR6kZp4eLU4778ifP+uDP6ZF+OsMRbE7oXWJTzodQXHax6zo3C6 1/kmLm6W+i9cADzLJRkC4M+rzcO9+bdrPbFAg= MIME-Version: 1.0 Received: by 10.229.238.72 with SMTP id kr8mr658593qcb.76.1273288708375; Fri, 07 May 2010 20:18:28 -0700 (PDT) Received: by 10.229.217.144 with HTTP; Fri, 7 May 2010 20:18:28 -0700 (PDT) In-Reply-To: <13D828CF2C5A6D4597111B6E6571FD6308FE1190B5@GMEXMBS2.globeandmail.net> References: <13D828CF2C5A6D4597111B6E6571FD6308FE1190B5@GMEXMBS2.globeandmail.net> Date: Fri, 7 May 2010 20:18:28 -0700 Message-ID: Subject: Re: caching repeated OR'd terms From: Lance Norskog To: solr-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org I would suggest benchmarking this before doing any more complex design. A field with only 10k unique integer or string values will search very very quickly. On Thu, May 6, 2010 at 7:54 AM, Nagelberg, Kallin wrote: > Hey everyone, > > I'm having some difficulty figuring out the best way to optimize for a ce= rtain query situation. My documents have a many-valued field that stores li= sts of IDs. All in all there are probably about 10,000 distinct IDs through= out my index. I need to be able to query and find all documents that contai= n a given set of IDs. Ie, I want to find all documents that contain IDs 3, = 202, 3030 or 505. Currently I'm implementing this like so: > > q=3D (myfield:3) OR (myfield:202) OR (myfield:3030) OR (myfield:505). > > It's possible that there could be upwards of hundreds of terms, although = 90% of the time it will be under 10. Ideally I would like to do this with a= filter query, but I have read that it is impossible to cache OR'd terms in= a fq, though this feature may come soon. The problem is that the combinati= ons of OR'd terms will almost always be unique, so the query cache will hav= e a very low hit rate. It would be great if the individual terms could be c= ached individually, but I'm not sure how to accomplish that. > > Any suggestions would be welcome! > -Kallin Nagelberg > > --=20 Lance Norskog goksron@gmail.com