I guess you could force the developer to return a JSON object with all those settings in them. For me, it made more sense to let them programmatically build an object. It also eliminated the expensive object-to-JSON conversion in previous versions. You are under no obligation to follow the couchdb-lucene programming model. That's my invention, not CouchDB's. Do whatever makes sense for your project. B. On Thu, Jun 10, 2010 at 8:53 PM, Norman Barker wrote: > Hi Robert, > > it seems I can fake a document object in spidermonkey (as I would like > to be compatible with Java Lucene) by doing var document = new > MyDocument(); where my MyDocument is an object we have defined. > However looking over your code I suggest that we could just use > > { >  "value": _, >  "type" : _, >  "field" : _ > } > > as the return and keep with JSON parsing as the message protocol as > per CouchDB. > > I know that JSON doesn't have a date type, but the type definition > overrides that. > > Your comments appreciated as I am probably missing something. > > Norman > > On Thu, Jun 10, 2010 at 1:36 PM, Norman Barker wrote: >> Robert, >> >> thanks, I am looking at the examples in your code. So >> >> var ret=new Document(); ret.add(parseInt(\"12.5\"), {type:\"int\", >> field:\"num\"}); >> >> I still don't see why you need the document object, why not just a >> JSON structure? >> >> 'new Document()' does cause a problem in SpiderMonkey for me when I am >> calling it from clucene but I will try to get it to work. >> >> Norman >> >> On Thu, Jun 10, 2010 at 12:55 PM, Robert Newson wrote: >>> The example on the wiki page is the most trivial example. Look at the >>> examples at http://github.com/rnewson/couchdb-lucene for less trivial >>> ones. >>> >>> The reason for a Document object is that there are many different ways >>> to index your date (different fields, numeric, date, tokenized, not >>> tokenized, stored, not stored, etc). >>> >>> B. >>> >>> On Thu, Jun 10, 2010 at 7:49 PM, Norman Barker wrote: >>>> Hi, >>>> >>>> why in >>>> >>>> http://wiki.apache.org/couchdb/Full_text_search >>>> >>>> does the index function create a new document and add results to it? >>>> >>>> is it equally valid just to return a string? >>>> >>>> I have nearly finished the clucene integration now, I will be posting >>>> some code towards the end of the week. >>>> >>>> If I have missed something with the new Document() in the index js >>>> function please let me know. >>>> >>>> thanks, >>>> >>>> Norman >>>> >>> >> >