Also, you have single quotes around the sort parameter? Try; ?sort=date&q=date<date>:[2010-02-10 TO 2010-05-10]
not ?'sort=date'&q=date<date>:[2010-02-10 TO 2010-05-10] On Tue, May 11, 2010 at 11:41 PM, Robert Newson <[email protected]> wrote: > You called your date field 'mydate' not 'date'. > > B. > > On Tue, May 11, 2010 at 11:11 PM, Jochen Kempf <[email protected]> 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<date>:[2010-02-10 TO 2010-05-10] >> ?'sort=date'&q=date<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 <[email protected]> >> >>> Thanks - that indeed fixed the issue! >>> >>> 2010/5/10 Robert Newson <[email protected]> >>> >>> 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 <[email protected]> >>>> 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.natived...@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? >>>> > >>>> >>> >>> >> >
