From user-return-10436-apmail-couchdb-user-archive=couchdb.apache.org@couchdb.apache.org Tue May 11 22:57:09 2010 Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 79253 invoked from network); 11 May 2010 22:57:09 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 May 2010 22:57:09 -0000 Received: (qmail 3419 invoked by uid 500); 11 May 2010 22:57:07 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 3389 invoked by uid 500); 11 May 2010 22:57:07 -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 3381 invoked by uid 99); 11 May 2010 22:57:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 May 2010 22:57:07 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,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 jochenkempf@gmail.com designates 209.85.160.52 as permitted sender) Received: from [209.85.160.52] (HELO mail-pw0-f52.google.com) (209.85.160.52) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 May 2010 22:57:01 +0000 Received: by pwj4 with SMTP id 4so650803pwj.11 for ; Tue, 11 May 2010 15:56:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:content-type; bh=rB9yLnnTE7K/wUNzEls665++WWgrpisW1IztP2i9rIo=; b=oHXCKuxPcmXuloAAWqd/+mr1PS30JmZrI3kIn8jdn698vQmhg6eokd0kHgToHLqzZx 0mutIRFGSt9BqBXD8wiXdgxAlt8cGMEOJlkQITt9pZN8veTujoAc6s02eGK9qybomtjD 7zPQFcHBUgC4dTv61xie2rwDo8Y4hWkUF+bzg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=R3KOdpS00dvuuOXM9WnuxQgGKkR0jOdVZ8B+4qKwM/F5Eh7bJdyCsoi+cfV6KLvQA+ NDmpBD/rSIKbDqRkstXroo4Nzug36ngW2DfSxUjXDarA/0snoIEX/uK3s3nwAPGV0vUf ybVgVCaw+b7XrxF53wdY7vYNBYtDtlLsj9bdM= Received: by 10.115.44.16 with SMTP id w16mr5043892waj.211.1273618599430; Tue, 11 May 2010 15:56:39 -0700 (PDT) MIME-Version: 1.0 Received: by 10.115.51.15 with HTTP; Tue, 11 May 2010 15:56:19 -0700 (PDT) In-Reply-To: References: From: Jochen Kempf Date: Tue, 11 May 2010 18:56:19 -0400 Message-ID: Subject: Re: Problems with date field in Lucene To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016e6493f7632cd5604865970cd X-Virus-Checked: Checked by ClamAV on apache.org --0016e6493f7632cd5604865970cd Content-Type: text/plain; charset=ISO-8859-1 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? > >>>> > > >>>> > >>> > >>> > >> > > > --0016e6493f7632cd5604865970cd--