You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Mark Hahn <ma...@hahnca.com> on 2012/07/19 20:25:05 UTC

noob problem getting started with lucene

(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?

Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
Could the problem be that the indexes folder is empty?  Is there something
I'm supposed to do to initialize the index?  The readme mentions nothing
about this.

On Fri, Jul 20, 2012 at 10:15 AM, Mark Hahn <ma...@hahnca.com> wrote:

> My local.ini for couch looks like this.  It shows up in the config page of
> futon.  And the example that uses _fit works.
>
>     [httpd_global_handlers]
>     _fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985
> ">>}
>
>      curl http://root:xxx@localhost:**5984/_fti
>      {"couchdb-lucene":"Welcome","**version":"0.9.0-SNAPSHOT"}
>
>      curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
> name?q=The+Buddy+Group
>      {"error":"not_found","reason":**"missing"}
>
> Doesn't the console output above show that couch.ini is setup and the
> proxy _fti  is working?  It is only the request that isn't working.
>
>
> On Fri, Jul 20, 2012 at 1:34 AM, Kai Griffin <ka...@resourceandrevenue.com>wrote:
>
>> Could be something not quite right in the relevant sections of your
>> local.ini?  The two "contradictory" request formats you mentioned earlier
>> represent the old and the new way that couch handles external requests
>> (couchdb-lucene in this case).  So, seeing that part of your local.ini
>> might help get to the bottom of it, hopefully...
>>
>>
>>
>> On 20/07/2012 01:22, Mark Hahn wrote:
>>
>>> 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-**31ea676b8139d4ef3a1a04d11fb952**e0",
>>>      .... 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 <rn...@apache.org>
>>> 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<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<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<http://localhost:5984/database/_fti/_design/foo/by_subject?q=hello>
>>>>>
>>>>>      curl
>>>>>
>>>> http://localhost:5984/mydb/_**fti/_design/mydesign/name?q=**testname<http://localhost:5984/mydb/_fti/_design/mydesign/name?q=testname>
>>>>
>>>>>     {"reason":"bad_request","code"**:400}
>>>>>
>>>>> Can someone suggest what I might be doing wrong?
>>>>>
>>>>
>>>>
>>
>

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
sorry, github issue: https://github.com/rnewson/couchdb-lucene/issues

B.

On 23 Jul 2012, at 06:39, Mark Hahn wrote:

> What is a jira issue?
> 
> On Sun, Jul 22, 2012 at 3:42 AM, Robert Newson <rn...@apache.org> wrote:
> 
>> Ah, good! I should have noticed that. If you submit a jira issue
>> requesting a better error message perhaps that will aid the next person
>> with a misconfiguration.
>> 
>> B.
>> 
>> 
>> On 22 Jul 2012, at 01:08, Mark Hahn wrote:
>> 
>>> I found my problem.  The lucene config said ...
>>> 
>>> [local]
>>> url=http://root:xxx@localhost:5985/
>>> 
>>> The 5985 was supposed to be 5984.
>>> 
>>> I want to thank you very much for your trouble.  If there are any lucene
>>> questions here I will try to pay this forward and help them.
>> 
>> 


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
What is a jira issue?

On Sun, Jul 22, 2012 at 3:42 AM, Robert Newson <rn...@apache.org> wrote:

> Ah, good! I should have noticed that. If you submit a jira issue
> requesting a better error message perhaps that will aid the next person
> with a misconfiguration.
>
> B.
>
>
> On 22 Jul 2012, at 01:08, Mark Hahn wrote:
>
> > I found my problem.  The lucene config said ...
> >
> > [local]
> > url=http://root:xxx@localhost:5985/
> >
> > The 5985 was supposed to be 5984.
> >
> > I want to thank you very much for your trouble.  If there are any lucene
> > questions here I will try to pay this forward and help them.
>
>

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
Ah, good! I should have noticed that. If you submit a jira issue requesting a better error message perhaps that will aid the next person with a misconfiguration.

B.


On 22 Jul 2012, at 01:08, Mark Hahn wrote:

> I found my problem.  The lucene config said ...
> 
> [local]
> url=http://root:xxx@localhost:5985/
> 
> The 5985 was supposed to be 5984.
> 
> I want to thank you very much for your trouble.  If there are any lucene
> questions here I will try to pay this forward and help them.


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
I found my problem.  The lucene config said ...

[local]
url=http://root:xxx@localhost:5985/

The 5985 was supposed to be 5984.

I want to thank you very much for your trouble.  If there are any lucene
questions here I will try to pay this forward and help them.

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
curl http://root:xxx@localhost
:5984/_fti/local/_design/aaa/name?q=The+Buddy+Group

is incorrect (it doesn't mention the database name)

curl http://root:xxx@localhost
:5984/_fti/local/dbname_goes_here/_design/aaa/name?q=The+Buddy+Group

B.

On 21 Jul 2012, at 21:58, Mark Hahn wrote:

> curl http://root:xxx@localhost
> :5984/_fti/local/_design/aaa/name?q=The+Buddy+Group


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
> Anything in couch.log or couchdb-lucene.log?

Here are the two versions of the commands, results, and logs ...

command 1 ...
    curl http://root:xxx@localhost
:5984/_fti/local/_design/aaa/name?q=The+Buddy+Group
result ...
    {"reason":"bad_request","code":400}
couch log ...
    [Sat, 21 Jul 2012 20:40:44 GMT] [info] [<0.350.0>] 127.0.0.1 - - GET
/_fti/local/_design/aaa/name?q=The+Buddy+Group 400
Lucene log was empty

command 2 ...
     curl http://root:xxx@localhost
:5984/ri/_fti/_design/aaa/name?q=The+Buddy+Group
result ...
    {"error":"not_found","reason":"missing"}
couch log ...
   [Sat, 21 Jul 2012 20:43:20 GMT] [info] [<0.412.0>] 127.0.0.1 - - GET
/ri/_fti/_design/aaa/name?q=The+Buddy+Group 404
Lucene log was empty

So it appears nothing is getting to lucene.

My couch local.ini ...
    [httpd_global_handlers]
    _fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985
">>}

my couchdb-lucene ini ...
    [local]
    url=http://root:xxx@localhost:5985/

couch version 1.2.0
lucene version 0.9.0-SNAPSHOT from a couple of nights ago

And once again evidence that proxy is working ...
     curl http://root:xxx@localhost:5984/_fti
    {"couchdb-lucene":"Welcome","version":"0.9.0-SNAPSHOT"}
couch log ...
    [Sat, 21 Jul 2012 20:47:37 GMT] [info] [<0.126.0>] 127.0.0.1 - - GET
/_fti 200
Lucene log is empty.

The lucene log shows output when lucene is started so I have the right log
file.

On Sat, Jul 21, 2012 at 10:05 AM, Robert Newson <rn...@apache.org> wrote:

> Hi,
>
> Anything in couch.log or couchdb-lucene.log?
>
> B.
>
> On 21 Jul 2012, at 04:54, Mark Hahn wrote:
>
> > Thanks.  That was the first URL I tried in the OP and it gave ...
> >
> >   {"reason":"bad_request","code":500}
> >
> > I guess I'll try starting over with the exact example from the readme.
>  If
> > nothing else then retyping everything may fix some typo.
> >
> > It's a shame everything has to work all at once to get anywhere.  I wish
> > there was some way to take it a step at a time and debug it.  The error
> > messages are useless.
> >
> > On Fri, Jul 20, 2012 at 4:31 PM, Robert Newson <rn...@apache.org>
> wrote:
> >
> >> From the README:
> >>
> >> "Note: The urls via the proxy have a different form:
> >>
> >> http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello
> >> "
> >>
> >> Adapted to your example;
> >>
> >> curl http://root:xxx@localhost
> >> :5984/_fti/local/fi/_design/aaa/**name?q=The+Buddy+Group
> >>
> >> B.
> >>
> >> On 20 Jul 2012, at 18:15, Mark Hahn wrote:
> >>
> >>> curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
> >>> name?q=The+Buddy+Group
> >>
> >>
>
>

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
Hi,

Anything in couch.log or couchdb-lucene.log?

B.

On 21 Jul 2012, at 04:54, Mark Hahn wrote:

> Thanks.  That was the first URL I tried in the OP and it gave ...
> 
>   {"reason":"bad_request","code":500}
> 
> I guess I'll try starting over with the exact example from the readme.  If
> nothing else then retyping everything may fix some typo.
> 
> It's a shame everything has to work all at once to get anywhere.  I wish
> there was some way to take it a step at a time and debug it.  The error
> messages are useless.
> 
> On Fri, Jul 20, 2012 at 4:31 PM, Robert Newson <rn...@apache.org> wrote:
> 
>> From the README:
>> 
>> "Note: The urls via the proxy have a different form:
>> 
>> http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello
>> "
>> 
>> Adapted to your example;
>> 
>> curl http://root:xxx@localhost
>> :5984/_fti/local/fi/_design/aaa/**name?q=The+Buddy+Group
>> 
>> B.
>> 
>> On 20 Jul 2012, at 18:15, Mark Hahn wrote:
>> 
>>> curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
>>> name?q=The+Buddy+Group
>> 
>> 


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
Thanks.  That was the first URL I tried in the OP and it gave ...

   {"reason":"bad_request","code":500}

I guess I'll try starting over with the exact example from the readme.  If
nothing else then retyping everything may fix some typo.

It's a shame everything has to work all at once to get anywhere.  I wish
there was some way to take it a step at a time and debug it.  The error
messages are useless.

On Fri, Jul 20, 2012 at 4:31 PM, Robert Newson <rn...@apache.org> wrote:

> From the README:
>
> "Note: The urls via the proxy have a different form:
>
> http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello
> "
>
> Adapted to your example;
>
> curl http://root:xxx@localhost
> :5984/_fti/local/fi/_design/aaa/**name?q=The+Buddy+Group
>
> B.
>
> On 20 Jul 2012, at 18:15, Mark Hahn wrote:
>
> > curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
> > name?q=The+Buddy+Group
>
>

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
From the README:

"Note: The urls via the proxy have a different form:

http://127.0.0.1:5984/_fti/local/db1/_design/cl-test/idx?q=hello
"

Adapted to your example;

curl http://root:xxx@localhost:5984/_fti/local/fi/_design/aaa/**name?q=The+Buddy+Group

B.

On 20 Jul 2012, at 18:15, Mark Hahn wrote:

> curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
> name?q=The+Buddy+Group


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
My local.ini for couch looks like this.  It shows up in the config page of
futon.  And the example that uses _fit works.

    [httpd_global_handlers]
    _fti = {couch_httpd_proxy, handle_proxy_req, <<"http://127.0.0.1:5985
">>}

     curl http://root:xxx@localhost:**5984/_fti
     {"couchdb-lucene":"Welcome","**version":"0.9.0-SNAPSHOT"}

     curl http://root:xxx@localhost:5984/ri/_fti/_design/aaa/**
name?q=The+Buddy+Group
     {"error":"not_found","reason":**"missing"}

Doesn't the console output above show that couch.ini is setup and the
proxy _fti  is working?  It is only the request that isn't working.


On Fri, Jul 20, 2012 at 1:34 AM, Kai Griffin <ka...@resourceandrevenue.com>wrote:

> Could be something not quite right in the relevant sections of your
> local.ini?  The two "contradictory" request formats you mentioned earlier
> represent the old and the new way that couch handles external requests
> (couchdb-lucene in this case).  So, seeing that part of your local.ini
> might help get to the bottom of it, hopefully...
>
>
>
> On 20/07/2012 01:22, Mark Hahn wrote:
>
>> 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-**31ea676b8139d4ef3a1a04d11fb952**e0",
>>      .... 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 <rn...@apache.org>
>> 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<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<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<http://localhost:5984/database/_fti/_design/foo/by_subject?q=hello>
>>>>
>>>>      curl
>>>>
>>> http://localhost:5984/mydb/_**fti/_design/mydesign/name?q=**testname<http://localhost:5984/mydb/_fti/_design/mydesign/name?q=testname>
>>>
>>>>     {"reason":"bad_request","code"**:400}
>>>>
>>>> Can someone suggest what I might be doing wrong?
>>>>
>>>
>>>
>

Re: noob problem getting started with lucene

Posted by Kai Griffin <ka...@resourceandrevenue.com>.
Could be something not quite right in the relevant sections of your 
local.ini?  The two "contradictory" request formats you mentioned 
earlier represent the old and the new way that couch handles external 
requests (couchdb-lucene in this case).  So, seeing that part of your 
local.ini might help get to the bottom of it, hopefully...


On 20/07/2012 01:22, Mark Hahn wrote:
> 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 <rn...@apache.org> 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?
>>


Re: noob problem getting started with lucene

Posted by Mark Hahn <ma...@hahnca.com>.
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 <rn...@apache.org> 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?
>
>

Re: noob problem getting started with lucene

Posted by Robert Newson <rn...@apache.org>.
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?