couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Szwed <d.sz...@hotmail.com>
Subject Can not get CouchDB external processes working
Date Fri, 23 Sep 2011 02:43:15 GMT

Hi,
I have been trying to get couchdb-lucene working with bigcouch for days now and cannot work
out what i am doing wrong, i have even tried the example on the couchdb wiki and cannot get
it to work either.

Bigcouch is running as a single node on the cluster:

curl -X GET http://localhost:5984/
{"couchdb":"Welcome","version":"1.0.2","bigcouch":"0.3.1"}

Created a database called 'database':
curl -X GET http://localhost:5984/database
{"db_name":"database","update_seq":"1-g1AAAAIReJzLYWBg4MhgTmFQT8pMT84vTc5wKErNzS9J1U3JLdbLS60oSU_NQ6JLcoAamBIZ8lgY_v__L5-VyECyZqBWIFCAmGBPvgkOEBPiyTchAWJCPfkmNEBMmE--CQsgJuzPSmQk04QDEBPuk--GBxAT_gNNyAIAL-WzZw","purge_seq":0,"doc_del_count":0,"doc_count":1,"disk_size":4732,"disk_format_version":5,"compact_running":false,"instance_start_time":"0"}

I have modified the /opt/bigcouch/etc/local.ini with:

[external]
test = python /usr/local/src/couchdb/test.py

[httpd_db_handlers]
_test = {couch_httpd_external, handle_external_req, <<"test">>}

[log]
level = debug

And created the /usr/local/src/couchdb/test.py containing:

import sys

try:
    # Python 2.6
    import json
except:
    # Prior to 2.6 requires simplejson
    import simplejson as json

def requests():
    # 'for line in sys.stdin' won't work here
    line = sys.stdin.readline()
    while line:
        yield json.loads(line)
        line = sys.stdin.readline()

def respond(code=200, data={}, headers={}):
    sys.stdout.write("%s\n" % json.dumps({"code": code, "json": data, "headers": headers}))
    sys.stdout.flush()

def main():
    for req in requests():
        respond(data={"qs": req["query"]})

if __name__ == "__main__":
    main()

Trying:
curl -X GET http://localhost:5984/database/_test

just gives an error  {"error":"not_found","reason":"missing"}.

Which is the same response when trying to get lucene working, looks like the external handlers
are not being found at all.

Any help would be appreciated.

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