couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Kempf <jochenke...@gmail.com>
Subject Re: Problems with date field in Lucene
Date Tue, 11 May 2010 22:56:19 GMT
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<date>..."


Thanks for your help anyway!

2010/5/11 Robert Newson <robert.newson@gmail.com>

> 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 <robert.newson@gmail.com>
> wrote:
> > You called your date field 'mydate' not 'date'.
> >
> > B.
> >
> > On Tue, May 11, 2010 at 11:11 PM, Jochen Kempf <jochenkempf@gmail.com>
> 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 <jochenkempf@gmail.com>
> >>
> >>> Thanks - that indeed fixed the issue!
> >>>
> >>> 2010/5/10 Robert Newson <robert.newson@gmail.com>
> >>>
> >>> 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 <jochenkempf@gmail.com>
> >>>> 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?
> >>>> >
> >>>>
> >>>
> >>>
> >>
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message