Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 66988 invoked from network); 6 Apr 2007 17:20:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Apr 2007 17:20:39 -0000 Received: (qmail 56545 invoked by uid 500); 6 Apr 2007 17:20:39 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 56512 invoked by uid 500); 6 Apr 2007 17:20:39 -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 56501 invoked by uid 99); 6 Apr 2007 17:20:39 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 10:20:39 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of yseeley@gmail.com designates 66.249.92.174 as permitted sender) Received: from [66.249.92.174] (HELO ug-out-1314.google.com) (66.249.92.174) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Apr 2007 10:20:32 -0700 Received: by ug-out-1314.google.com with SMTP id k40so1315236ugc for ; Fri, 06 Apr 2007 10:20:11 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=IAdTlUhhbm60b7mDUITPZ/CXLGLslZkN9TBEmflEuU9sqFRhiRTqA3drDvPaq2fAa4t/htIyniKTntnwVPBQTTLQWCCbPATApnOePo/yBlI3q1PpvNdYOqAm/bGuIHW72OAV7JxcfrlMW0BaPUZVa9pSpB1VzN3Ci7k3UzvB1Pk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=OMQzHzDQWrglqSw8d/HzV4Jq4YmuedvvsEMZhQFyaUifASjF7rDRqSsX7cvOuFBOEpE8uAivkhRnRNDht8fBQnXny81Gs+v7MsA3s2Lh/WsylZQnZQoSa+WGYv6i3NxXb5K/NYBB5KVjp2vfU8U3VSVxhSPIxlR5l7xMVWgfDXI= Received: by 10.82.138.6 with SMTP id l6mr4760151bud.1175880010867; Fri, 06 Apr 2007 10:20:10 -0700 (PDT) Received: by 10.82.126.8 with HTTP; Fri, 6 Apr 2007 10:20:10 -0700 (PDT) Message-ID: Date: Fri, 6 Apr 2007 13:20:10 -0400 From: "Yonik Seeley" Sender: yseeley@gmail.com To: java-user@lucene.apache.org Subject: Re: indexing and searching real numbers In-Reply-To: <9859816.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <9859816.post@talk.nabble.com> X-Google-Sender-Auth: 3030c9923fbae974 X-Virus-Checked: Checked by ClamAV on apache.org On 4/5/07, Leon wrote: > I need to index and search real numbers in Lucene. I found NumberUtils cl= ass > in Solr project which permits one to encode doubles into string so that > alpha numeric ordering would correctly correspond to the ordering on > numbers. When I use ConstantScoreRangeQuery programmatically everything > works just fine. However when I convert this query to a string, parse it > with QueryParser and use the resulting query =96 no result are found. > > ConstantScoreRangeQuery wquery =3D > new ConstantScoreRangeQuery("westbc", null, > NumberUtils.double2sortableStr(-110.500000), false, true); > Hits hits =3D is.search(wquery); //returns expected results > > Now if I do > > String wqueryString =3D wquery.toString(); > QueryParser queryParser =3D new QueryParser("westbc", new KeywordAnalyzer= ()); > Query query =3D queryParser.parse(wqueryString); > Hits hits =3D is.search(query); // returns nothing Query.toString() is really for debugging only, and I don't believe current implementations try to escape characters that might be interpreted as something else if reparsed. Simple example... I think (new TermQuery(new Term("foo","\"a\""))).toString() would yield foo:"a" which if put through the query parser, would be parsed as foo:a -Yonik --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org