Return-Path: X-Original-To: apmail-incubator-lucy-user-archive@www.apache.org Delivered-To: apmail-incubator-lucy-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9DA9278E8 for ; Sat, 10 Sep 2011 16:51:20 +0000 (UTC) Received: (qmail 96529 invoked by uid 500); 10 Sep 2011 16:51:20 -0000 Delivered-To: apmail-incubator-lucy-user-archive@incubator.apache.org Received: (qmail 96492 invoked by uid 500); 10 Sep 2011 16:51:20 -0000 Mailing-List: contact lucy-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: lucy-user@incubator.apache.org Delivered-To: mailing list lucy-user@incubator.apache.org Received: (qmail 96484 invoked by uid 99); 10 Sep 2011 16:51:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Sep 2011 16:51:19 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gorankent@gmail.com designates 209.85.220.175 as permitted sender) Received: from [209.85.220.175] (HELO mail-vx0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Sep 2011 16:51:13 +0000 Received: by vxh2 with SMTP id 2so1049350vxh.6 for ; Sat, 10 Sep 2011 09:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=4mq8zJxFlN4erHEzDTLKOQbx0BGvW9aTn5N5qfIM0yU=; b=JxfSjAYRnlI1nCXPnRqeCiYC8iMt7MQwTILajtUHvFVEhgho29z7/Nc7AfHmik8ijF sYM9FD8Y5tfwd5b/bQuU9EI//0+AfRsZENLZsU+HSiZgD73dRxMX5NPGk7HGeE33e0Ok XhG+/Cu5w1j4dGxQ+wZZvwYy5Xjy7p3vNnc7M= MIME-Version: 1.0 Received: by 10.52.24.33 with SMTP id r1mr1730422vdf.279.1315673452605; Sat, 10 Sep 2011 09:50:52 -0700 (PDT) Received: by 10.52.109.230 with HTTP; Sat, 10 Sep 2011 09:50:52 -0700 (PDT) In-Reply-To: <20110910022548.GA8488@rectangular.com> References: <20110908200509.GD24449@rectangular.com> <20110910022548.GA8488@rectangular.com> Date: Sat, 10 Sep 2011 18:50:52 +0200 Message-ID: From: goran kent To: lucy-user@incubator.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [lucy-user] Lucy questions wrt production, ranking, etc On Sat, Sep 10, 2011 at 4:25 AM, Marvin Humphrey w= rote: > You must stringify during indexing. > > Here's example indexing code where both the "date" and "rainfall" fields = are > prepared using sprintf() so that they will sort in the desired order: > > =A0 =A0my %doc =3D ( > =A0 =A0 =A0 =A0location =3D> $location, > =A0 =A0 =A0 =A0date =A0 =A0 =3D> sprintf("%0.4d-%0.2d-%0.2d", $year, $mon= th, $day), > =A0 =A0 =A0 =A0rainfall =3D> sprintf("%07.4f", $cm_rainfall), # e.g. 01.1= 482 > =A0 =A0); > =A0 =A0$indexer->add_doc(\%doc); > > Of course you have to choose an adequate precision so you don't overflow = and > screw up the sort order. :) Hmm, my sort floats are typically like this: min: 0.1254619125 max: 3117.88289166118 typical: 0.231372871201865 (15 dec places max) sprintf("%0.15f") in Perl produces: 0.125461912500000 ok 3117.882891661180111 screw up (should be 3117.882891661180000) 0.231372871201865 ok I imagine the large value 3117 with the added "0111" won't present a problem when sorting -- but I have a feeling I'm wrong, right?