Thanks so much for the help.
What I showed was actually the contents of the design doc fulltext field as
shown in futon. I should have said so. Here is the entire unadulterated
source of the design doc. I think it is correct.
{
"_id": "_design/aaa",
"_rev": "57-31ea676b8139d4ef3a1a04d11fb952e0",
.... views and updates snipped ....
"fulltext": {
"name": {
"index": "function (doc) { var ret; if (doc.name &&
!doc.closed && !doc._deleted) { ret = new Document();
ret.add(doc.name); log.info('hello lucene world'); return ret; } }"
}
}
}
I just noticed that my original post has a mistake. The second curl
example showed the wrong response. Here it is again with the exact command
I used (except for password).
curl http://root:xxx@localhost
:5984/ri/_fti/_design/aaa/name?q=The+Buddy+Group
{"error":"not_found","reason":"missing"}
When I googled this result I found this error in a lot of posts where the
author had the _fti incorrectly set up in couch. But I think this console
output proves that my _fti is correct. No?
curl http://root:xxx@localhost:5984/_fti
{"couchdb-lucene":"Welcome","version":"0.9.0-SNAPSHOT"}
On Thu, Jul 19, 2012 at 3:26 PM, Robert Newson <[email protected]> wrote:
> Your design document looks wrong to me (or you've omitted important parts
> of it). Here's the one from the README for comparison;
>
> {
> "_id":"_design/foo",
> "fulltext": {
> "by_subject": {
> "index":"function(doc) { var ret=new Document();
> ret.add(doc.subject); return ret }"
> },
> "by_content": {
> "index":"function(doc) { var ret=new Document();
> ret.add(doc.content); return ret }"
> }
> }
> }
>
> Note: the top-level key is called "fulltext", this is absent from your
> design document.
>
> B.
>
> On 19 Jul 2012, at 19:25, Mark Hahn wrote:
>
> > (I posted this as an issue on rnewson/couchdb-lucene and I moved it here)
> >
> > I cannot get a lucene query to work and need help.
> >
> > Lucene is running ok and the proxy from couchdb to lucene is working.
> >
> > curl http://127.0.0.1:5985
> > {"couchdb-lucene":"Welcome","version":"0.9.0-SNAPSHOT"}
> >
> > curl http://root:tbgcomps2@localhost:5984/_fti
> > {"couchdb-lucene":"Welcome","version":"0.9.0-SNAPSHOT"}
> >
> > My index view looks like this but the indexes directory is empty. When
> is
> > Lucene supposed to create the index? On the first request?
> >
> > {
> > name: {
> > index: function (doc) {
> > var ret;
> > if (doc.name && !doc.closed && !doc._deleted) {
> > ret = new Document();
> > ret.add(doc.name);
> > return ret;
> > }
> > }
> > }
> > }
> >
> > I've tried both of these URLs. They are based on two different examples
> in
> > the readme, which seem to be contradictory formats.
> >
> > Readme example:
> > http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello
> >
> > curl
> > http://localhost:5984/_fti/local/mydb/_design/mydesign/name?q=testname
> > {"reason":"bad_request","code":500}
> >
> > Readme example:
> > http://localhost:5984/database/_fti/_design/foo/by_subject?q=hello
> >
> > curl
> http://localhost:5984/mydb/_fti/_design/mydesign/name?q=testname
> > {"reason":"bad_request","code":400}
> >
> > Can someone suggest what I might be doing wrong?
>
>