Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 53665 invoked from network); 11 Nov 2009 14:06:40 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 11 Nov 2009 14:06:40 -0000 Received: (qmail 25676 invoked by uid 500); 11 Nov 2009 14:06:38 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 25582 invoked by uid 500); 11 Nov 2009 14:06:38 -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 25565 invoked by uid 99); 11 Nov 2009 14:06:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 14:06:38 +0000 X-ASF-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yseeley@gmail.com designates 209.85.220.228 as permitted sender) Received: from [209.85.220.228] (HELO mail-fx0-f228.google.com) (209.85.220.228) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 11 Nov 2009 14:06:35 +0000 Received: by fxm28 with SMTP id 28so1078219fxm.5 for ; Wed, 11 Nov 2009 06:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:reply-to:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=6giSekVnbgCb8V6mO5aNuFe3PdgN5HeTBcm1tpe2TK4=; b=epqsqeAcpk+Fmuq5UdHwVyT62HMivUWms5Dlgn90KNoHLMva61rU59SbnF1wiHBRJj XJJ/sqr4tRyzGz/Qc986et4kjbCCWhC40f9xK0tcckbGdFtSoiDhhC26cAAE/NHi7RK+ WRb/FV19DU+WmGXb/7O2p8XD/Cj5jgOR19k2k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:reply-to:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=jypiP4Qx3Htb257TFP2WToQ9512yqsbYrAYkShF0Ui9EmRqqTIWwqhZU83HGYkbGZo mnCetjif2mrkd/LaAsLVD0FBpZeWaL3GG9mwCvXob55grFeWO82L6cvIZySp1MRYn7Kr K58aWldeFamsxvMcdQ1228dzNfIBNFYsw4ZhU= MIME-Version: 1.0 Sender: yseeley@gmail.com Reply-To: yonik@lucidimagination.com Received: by 10.216.87.69 with SMTP id x47mr506927wee.97.1257948374374; Wed, 11 Nov 2009 06:06:14 -0800 (PST) In-Reply-To: <786fde50911110554m3268b98do9bcf18308ab3a578@mail.gmail.com> References: <786fde50911110554m3268b98do9bcf18308ab3a578@mail.gmail.com> Date: Wed, 11 Nov 2009 09:06:14 -0500 X-Google-Sender-Auth: 2584fbffdd7989a0 Message-ID: Subject: Re: Equality Numeric Query From: Yonik Seeley To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 On Wed, Nov 11, 2009 at 8:54 AM, Shai Erera wrote: > I index documents with numeric fields using the new Numeric package. I > execute two types of queries: range queries (for example, [1 TO 20}) and > equality queries (for example 24.75). Don't mind the syntax. > > Currently, to execute the equality query, I create a NumericRangeQuery with > the lower/upper value being 24.75 and both limits are set to inclusive. Two > questions: > 1) Is there a better approach? For example, if I had indexed the values as > separate terms, I could create a TermQuery. Create a term query on NumericUtils.floatToPrefixCoded(24.75f) > 2) Can I run into precision issues such that 24.751 will be matched as well? Nope... every numeric indexed value has it's precision indexed along with it as a prefix, so there will be no false matches. -Yonik http://www.lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org