From user-return-10440-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Wed May 12 07:54:45 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 4673 invoked from network); 12 May 2010 07:54:45 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 May 2010 07:54:45 -0000 Received: (qmail 25305 invoked by uid 500); 12 May 2010 07:54:43 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 24976 invoked by uid 500); 12 May 2010 07:54:41 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 24968 invoked by uid 99); 12 May 2010 07:54:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 May 2010 07:54:40 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=AWL,FREEMAIL_FROM,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of robert.newson@gmail.com designates 74.125.82.180 as permitted sender) Received: from [74.125.82.180] (HELO mail-wy0-f180.google.com) (74.125.82.180) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 May 2010 07:54:36 +0000 Received: by wyb32 with SMTP id 32so1637306wyb.11 for ; Wed, 12 May 2010 00:54:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:from:in-reply-to:mime-version :references:date:message-id:subject:to:content-type; bh=AVSJfnoQ2Oe9lpEDyVd993eNKQdihv30YI6u3URTFtg=; b=Jyh/HLQmEvRM+pjWp25MrKus+P1+LmMow9y1N8lawubUb7lMzV7VTKpHgYiT9p9p/K 48Y9p/zcbk/5+z/s95Kf2w6HwbD+10siyiX60lUAqZcqB/OL/JYvSX2lv/3NbDeErqoG M/EL2YF/rKydKv8SFINnP1bSHmG0OZQNgS1XU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:in-reply-to:mime-version:references:date:message-id:subject:to :content-type; b=Yz6DGssetq/LqTBZH5gd+pa4BJuG13g8A2ZyebeqVrLUzpNYlqOZLXpv4FHQv3NF9t Nr07F7KoFxJ0aOmH6JKpDFD90HWZ1UsA4deVBSBlM22HV7tQRCpgAF+sKsPQAS7x374F psjGAGvXnN5HkM2suQb79z2J/Czs9Y1DHN+LI= Received: by 10.216.87.6 with SMTP id x6mr1231234wee.172.1273650854459; Wed, 12 May 2010 00:54:14 -0700 (PDT) From: Robert Newson In-Reply-To: Mime-Version: 1.0 (iPad Mail 7B367) References: Date: Wed, 12 May 2010 08:54:41 +0100 Message-ID: <3099782738791640900@unknownmsgid> Subject: Re: Problems with date field in Lucene To: "user@couchdb.apache.org" Content-Type: text/plain; charset=ISO-8859-1 I've simplified the example, sorry it misled you. Date sorting is now working for you as expected? Sent from my iPad On 11 May 2010, at 23:56, Jochen Kempf wrote: > Hi Robert! > > I changed the name of my date field from "mydate" to "date" - so far there > are no problems. > > As concerincing the single quotes around the sort parameter - I followed the > example for type-specific sorting on > http://github.com/rnewson/couchdb-lucene where it says "Type-specific > sorting is also available by appending the type between angle brackets (e.g, > 'sort=amount')." > > Well, I am not a native english speaker and thought that "angle brackets" > are "single quotes" as I did misinterprete the example given in the docu. > > After using a dictionary I noticed it has to be: "?sort=date..." > > > Thanks for your help anyway! > > 2010/5/11 Robert Newson > >> Also, you have single quotes around the sort parameter? >> >> Try; >> ?sort=date&q=date:[2010-02-10 TO 2010-05-10] >> >> not >> ?'sort=date'&q=date:[2010-02-10 TO 2010-05-10] >> >> On Tue, May 11, 2010 at 11:41 PM, Robert Newson >> wrote: >>> You called your date field 'mydate' not 'date'. >>> >>> B. >>> >>> On Tue, May 11, 2010 at 11:11 PM, Jochen Kempf >> wrote: >>>> I just realized that I cannot sort the query result by a date type >> field. >>>> >>>> I tried it using the following queries: >>>> ?'sort=\date'&q=date:[2010-02-10 TO 2010-05-10] >>>> ?'sort=date'&q=date:[2010-02-10 TO 2010-05-10] >>>> >>>> and got always the same result: >>>> { >>>> "q": "date:[1265770800000 TO 1273464000000]", >>>> "plan": "NumericRangeQuery(1265770800000 TO 1273464000000 AS >>>> Long,boost=1.0)", >>>> "etag": "1a28be0d8443", >>>> "skip": 0, >>>> "limit": 25, >>>> "total_rows": 3, >>>> "search_duration": 2, >>>> "fetch_duration": 1, >>>> "rows": [ >>>> { >>>> "id": "488f231a58b84f745fca058c4b3dd03d", >>>> "score": 1, >>>> "fields": { >>>> "date": "1273464000000" >>>> } >>>> }, >>>> { >>>> "id": "488f231a58b84f745fca058c4b5ca2e1", >>>> "score": 1, >>>> "fields": { >>>> "date": "1267498800000" >>>> } >>>> }, >>>> { >>>> "id": "488f231a58b84f745fca058c4b5c99cf", >>>> "score": 1, >>>> "fields": { >>>> "date": "1268103600000" >>>> } >>>> } >>>> ] >>>> } >>>> >>>> Am I doing something wrong? >>>> >>>> 2010/5/10 Jochen Kempf >>>> >>>>> Thanks - that indeed fixed the issue! >>>>> >>>>> 2010/5/10 Robert Newson >>>>> >>>>> Please ensure you are using the 0.5.0 release, several date-related >>>>>> bugs were fixed a few days before the release. >>>>>> >>>>>> To be sure you have the right artifacts, consider using the official >>>>>> zip: >>>>>> >> http://github.com/downloads/rnewson/couchdb-lucene/couchdb-lucene-0.5.0-dist.zip >>>>>> >>>>>> B. >>>>>> >>>>>> On Mon, May 10, 2010 at 4:20 PM, Jochen Kempf >>>>>> wrote: >>>>>>> Hi, >>>>>>> I am trying to add a date field to a index view in CouchDB Lucene >> but >>>>>>> whatever I try I always get a "caused Unable to parse the date: >>>>>>> ORG.MOZILLA.JAVASCRIPT.NATIVEDATE@19E11A1" error. >>>>>>> >>>>>>> Here is the easiest code example I tried: >>>>>>> >>>>>>> "index":"function(doc) { >>>>>>> var result = new Document(); >>>>>>> var mydate = new Date(2010, 4, 10); >>>>>>> result.add(mydate, {'field':'mydate', 'type': 'date', >> 'store':'yes'}); >>>>>>> result.add(doc.year, {'field':'year', 'store':'yes'}); >>>>>>> result.add(doc.month, {'field':'month', 'store':'yes'}); >>>>>>> result.add(doc.day, {'field':'day', 'store':'yes'}); >>>>>>> return result; >>>>>>> }" >>>>>>> Any suggestions? >>>>>>> >>>>>> >>>>> >>>>> >>>> >>> >>