Ok found it using http://jsonlint.com/. "attachment" needs to be 'attachment' or "default", 'default' depending on which version of the index all I use (http://wiki.fluidproject.org/display/fluid/Setting+Up+CouchDB+and+Lucene or https://github.com/rnewson/couchdb-lucene).
All seems to be working now. Mike -----Original Message----- From: Mike Kimber [mailto:[email protected]] Sent: 16 May 2012 21:20 To: [email protected] Subject: Couch-lucene - Index all - JSON.parse: expected ',' or '}' after property value in object Ive built/installed couch-lucene and pointed it at my couchdb database (1.2). It works when I index a a individual attribute/key pair, but when I try an use the index all js code on https://github.com/rnewson/couchdb-lucene via futon I get JSON.parse: expected ',' or '}' after property value in object JSON.parse: expected ',' or '}' after property value in object Ive tried formatting it etc and it all looks fine, but the error message states that the JSON is not valid. My design document looks like: { "_id": "_design/lucene", "_rev": "18-22fdad425fb9f8cd1d8e39ba4b871103", "language": "javascript", "fulltext": { "all": { "index": "function(doc) {var ret = new Document(); function idx(obj) {for (var key in obj) {switch (typeof obj[key]) {case 'object': idx(obj[key]); break; case 'function': break; default: ret.add(obj[key]); break;}}}; idx(doc); if (doc._attachments) {for (var i in doc._attachments) {ret.attachment("attachment", i); }}return ret; }" } } } The following works, so this suggest to me that it's the javascript that is the issue Source { "_id": "_design/lucene", "_rev": "19-1c7be47e52f8a65e9bb387e8c3251dd4", "language": "javascript", "fulltext": { "by_type": { "index": "function(doc) { var res = new Document(); res.add( doc.header.started); return res; }" } } } Any help would be greatly as would be any tips on how to debug this sort of thing in the future. Thanks Mike
