Skip to content

Commit 5a3fff0

Browse files
committed
update README with new design doc schema
1 parent 79892d0 commit 5a3fff0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ For the following example, my database is named "wikipedia". The design documen
4646
"language":"java",
4747
"views" :
4848
{
49-
"title" : {"map":"{\"classname\":\"com.cloudant.javaviews.SplitText\",\"configure\":\"title\"}","reduce":"com.cloudant.javaviews.SplitText"},
50-
"text" : {"map":"{\"classname\":\"com.cloudant.javaviews.SplitText\",\"configure\":\"text\"}","reduce":"com.cloudant.javaviews.SplitText"}
49+
"title" : {"map":{"classname":"com.cloudant.javaviews.SplitText","configure":"title"},"reduce":"com.cloudant.javaviews.SplitText"},
50+
"text" : {"map":{"classname":"com.cloudant.javaviews.SplitText","configure":"text"},"reduce":"com.cloudant.javaviews.SplitText"}
5151
}
5252
}
5353

54-
Note that you need to pass a single variable to "map", the full class name of your JavaView implementation. The "configure" field is optional and allows you to configure your class at run time. Also note that by CouchDB design, the values pointed to by the "map" and "reduce" keys are strings. In the case of "map", we stringify the JSON object that is used to configure "map" (that's why we need to escape the quotes).
54+
Note that you required to pass an JSON Object to "map" containing the full class name of your JavaView implementation. The "configure" field is optional and allows you to configure your class at run time. Reduce takes a single string with the name of the class containing Java reduce function (or a CouchDB builtin like _count, _sum, etc.)
5555

5656
Upload this design doc, either using the command line interface or by saving the file on disk as splittext.json:
5757

@@ -79,7 +79,7 @@ To use [com.cloudant.indexers.MyCustomSearch][6] for indexing your database, you
7979
"language":"java",
8080
"views" :
8181
{
82-
"index" : {"map":"{\"classname\":\"com.cloudant.indexers.MyCustomSearch\",\"configure\":{\"analyzer\":\"org.apache.lucene.analysis.WhitespaceAnalyzer\",\"fields[{\"name\":\".*\",\"lucenename\":\"all\",\"type\":\"string\",\"regexp\":true}]}}","reduce":"_count"}
82+
"index" : {"map":{"classname":"com.cloudant.indexers.MyCustomSearch","configure":{"analyzer":"org.apache.lucene.analysis.WhitespaceAnalyzer","fields[{"name":".*","lucenename":"all","type":"string","regexp":true}]}},"reduce":"_count"}
8383
}
8484
}
8585

0 commit comments

Comments
 (0)