Nope, you just had to escape the embedded double quote since you're
inside a string already.

B.

On 17 May 2012 08:33, Mike Kimber <[email protected]> wrote:
> Nope I had to change "attachment" to 'attachment'
>
> Mike
>
> -----Original Message-----
> From: Robert Newson [mailto:[email protected]]
> Sent: 16 May 2012 22:25
> To: [email protected]
> Subject: Re: Couch-lucene - Index all - JSON.parse: expected ',' or '}' after 
> property value in object
>
> Hi Mike,
>
> I just verified the Index Everything snippet at
> https://github.com/rnewson/couchdb-lucene locally, it worked fine for
> me. Perhaps you missed off a character when you pasted it into futon?
>
> B.
>
> On 16 May 2012 21:20, Mike Kimber <[email protected]> wrote:
>> 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
>>

Reply via email to