CouchDB Search data_prepare

Install cradle

$ npm install cradle
cradle@0.6.7 node_modules/cradle
├── vargs@0.1.0
├── request@2.36.0 (tunnel-agent@0.4.0, json-stringify-safe@5.0.0, forever-agent@0.5.2, aws-sign2@0.5.0, qs@0.6.6, oauth-sign@0.3.0, node-uuid@1.4.1, mime@1.2.11, tough-cookie@0.12.1, form-data@0.1.4, http-signature@0.10.0, hawk@1.0.0)
└── follow@0.10.4 (debug@0.7.4, browser-request@0.3.1, request@2.30.0)
How to prepare data

#
export http_proxy=""
#
export NODE_PATH=/home/uchida/node_modules
#
curl -X DELETE http://localhost:5984/librivox_books
curl -X PUT http://localhost:5984/librivox_books
#
ls data/*.json | sed 's/data\///' | sed 's/.json//' > list.txt
#
./to_couchdb.js list.txt
How to prepare server side script

curl -X PUT http://localhost:5984/librivox/_design/myapp4 -d@ex04.json

How to check the function

curl http://localhost:5984/librivox/_design/myapp4/_view/ex04?key=\"Japanese\"

curl http://localhost:5984/librivox/_design/myapp4/_view/ex04?key=\"Italian\"

curl http://localhost:5984/librivox/_design/myapp4/_view/ex04?key=\"Polish\"


Jul/10/2014 AM 08:15