Skip to content
This repository
Newer
Older
100644 517 lines (410 sloc) 17.271 kb
b9ba5b0d »
2009-08-31 warn against using 0.5 for now.
1 <h1>WARNING</h1>
90790ae3 »
2009-08-31 add recommendation for 0.4 for now.
2
ef3d4be0 »
2009-12-22 tentatively recommend 0.5 over 0.4
3 0.5 is not yet released and may contain bugs and regressions. However, it is shaping up nicely so I recommend you try it first. 0.4 remains available if you hit insurmountable problems; but please take time to file a ticket at github if you do.
90790ae3 »
2009-08-31 add recommendation for 0.4 for now.
4
6d1c0742 »
2009-09-15 add notes about version compatibility.
5 <h1>Version Compatibility</h1>
6
7 <table>
8 <tr><th>CouchDB</th><th>couchdb-lucene</th></tr>
9 <tr><td>0.9.1, 0.10</td><td>0.4</td></tr>
d90560d8 »
2009-10-09 update docs.
10 <tr><td>0.11 (not yet released)</td><td>0.4-maint (0.4 with patch for trunk compatibility)</td></tr>
fc8e42cd »
2009-12-21 add support for 0.10.x
11 <tr><td>0.10+</td><td>0.5 (not yet released)</td></tr>
6d1c0742 »
2009-09-15 add notes about version compatibility.
12 </table>
13
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
14 <h1>Issue Tracking</h1>
a785480d »
2009-05-09 lighthouse sucks at formatting anything, abandon ship.
15
7a0d1d38 »
2009-05-09 lighthouse sucks at formatting anything, abandon ship.
16 Issue tracking at <a href="http://github.com/rnewson/couchdb-lucene/issues">github</a>.
5d4e56ad »
2009-03-06 update readme.
17
7dc5bac3 »
2009-09-02 reorg begins.
18 <h1>Minimum System Requirements</h1>
ef3f787b »
2009-04-06 add sysreq for Sun JDK.
19
796a42b6 »
2009-10-08 jdk 5 compatibility for readme.
20 Java 1.5 (or above) is required; the Sun version is recommended as it's regularly tested against.
ef3f787b »
2009-04-06 add sysreq for Sun JDK.
21
5220b654 »
2009-02-14 tweak README.md
22 <h1>Build couchdb-lucene</h1>
b2079657 »
2009-02-14 improve README readability.
23
24 <ol>
25 <li>Install Maven 2.
26 <li>checkout repository
27 <li>type 'mvn'
28 <li>configure couchdb (see below)
29 </ol>
30
2d6180b9 »
2009-10-07 include properties file in zip. still not available to run script, th…
31 You will now have a zip file in the target/ directory. This contains all the couchdb-lucene code, dependencies, startup scripts and configuration files to run couchdb-lucene.
32
b2079657 »
2009-02-14 improve README readability.
33 <h1>Configure CouchDB</h1>
34
35 <pre>
05631204 »
2009-03-07 fixes.
36 [couchdb]
37 os_process_timeout=60000 ; increase the timeout from 5 seconds.
38
b2079657 »
2009-02-14 improve README readability.
39 [external]
5675f7a4 »
2010-01-07 fix path
40 fti=/path/to/python /path/to/couchdb-lucene/tools/couchdb-external-hook.py
b2079657 »
2009-02-14 improve README readability.
41
42 [httpd_db_handlers]
43 _fti = {couch_httpd_external, handle_external_req, <<"fti">>}
44 </pre>
45
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
46 <h2>Hook options</h2>
47
48 <table>
49 <tr><th>Option</th><th>Meaning</th><th>Default Value</th></tr>
50 <tr><td>--remote-host</td><td>The hostname of the couchdb-lucene server</td><td>localhost</td></tr>
51 <tr><td>--remote-port</td><td>The port of the couchdb-lucene server</td><td>5985</td></tr>
52 <tr><td>--local-host</td><td>The hostname of the couchdb server</td><td>localhost</td></tr>
53 <tr><td>--local-port</td><td>The port of the couchdb server</td><td>5984</td></tr>
54 </table>
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
55
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
56 <h1>Configure couchdb-lucene</h1>
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
57
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
58 couchdb-lucene runs in a single, standalone JVM. As such, you can choose to locate your couchdb-lucene server on a different machine to couchdb if you wish, or keep it on the same machine, it's your call.
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
59
60 <h1>Start couchdb-lucene</h1>
61
62 To start couchdb-lucene, run;
63 <pre>
2d6180b9 »
2009-10-07 include properties file in zip. still not available to run script, th…
64 bin/run
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
65 </pre>
66
2d6180b9 »
2009-10-07 include properties file in zip. still not available to run script, th…
67 To stop couchdb-lucene, simply kill the Java process.
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
68
b2079657 »
2009-02-14 improve README readability.
69 <h1>Indexing Strategy</h1>
70
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
71 <h2>Document Indexing</h2>
72
4c21806e »
2009-07-15 mention that you can return Document[] from an index function.
73 You must supply a index function in order to enable couchdb-lucene as, by default, nothing will be indexed. To suppress a document from the index, return null. It's more typical to return a single Document object which contains everything you'd like to query and retrieve. You may also return an array of Document objects if you wish.
a2e9024b »
2009-03-06 wip
74
437eae90 »
2009-05-03 s/view/fulltext in README.md
75 You may add any number of index views in any number of design documents. All searches will be constrained to documents emitted by the index functions.
c207a604 »
2009-04-04 update README
76
50773667 »
2009-07-09 clarify design document and add matching query URL's.
77 Here's an complete example of a design document with couchdb-lucene features:
a2e9024b »
2009-03-06 wip
78
697884bd »
2009-04-21 documentation of future features.
79 <pre>
80 {
d1c9c80d »
2009-08-25 correct _id of first example.
81 "_id":"_design/a_design_document_with_any_name_you_like",
50773667 »
2009-07-09 clarify design document and add matching query URL's.
82 "fulltext": {
83 "by_subject": {
84 "index":"function(doc) { var ret=new Document(); ret.add(doc.subject); return ret }"
85 },
86 "by_content": {
87 "index":"function(doc) { var ret=new Document(); ret.add(doc.content); return ret }"
88 }
697884bd »
2009-04-21 documentation of future features.
89 }
90 }
91 </pre>
92
50773667 »
2009-07-09 clarify design document and add matching query URL's.
93 Here are some example URL's for the given design document;
94
95 <pre>
96 http://localhost:5984/database/_fti/lucene/by_subject?q=hello
97 http://localhost:5984/database/_fti/lucene/by_content?q=hello
98 </pre>
99
697884bd »
2009-04-21 documentation of future features.
100 A fulltext object contains multiple index view declarations. An index view consists of;
101
102 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
103 <dt>analyzer</dt><dd>(optional) The analyzer to use</dd>
104 <dt>defaults</dt><dd>(optional) The default for numerous indexing options can be overridden here. A full list of options follows.</dd>
697884bd »
2009-04-21 documentation of future features.
105 <dt>index</dt><dd>The indexing function itself, documented below.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
106 </dl>
697884bd »
2009-04-21 documentation of future features.
107
108 <h3>The Defaults Object</h3>
109
110 The following indexing options can be defaulted;
111
112 <table>
113 <tr>
114 <th>name</th>
115 <th>description</th>
116 <th>available options</th>
117 <th>default</th>
118 </tr>
119 <tr>
a40523d3 »
2009-04-21 documentation of future features.
120 <th>field</th>
121 <td>the field name to index under</td>
122 <td>user-defined</td>
123 <td>default</td>
d2e1e9ea »
2009-08-31 add notes about typing.
124 </tr>
125 <tr>
126 <th>type</th>
127 <td>the type of the field</td>
128 <td>date, double, float, integer, long, string</td>
129 <td>string</td>
130 </tr>
a40523d3 »
2009-04-21 documentation of future features.
131 <tr>
697884bd »
2009-04-21 documentation of future features.
132 <th>store</th>
f16fc9c8 »
2009-04-26 docs
133 <td>whether the data is stored. The value will be returned in the search result.</td>
697884bd »
2009-04-21 documentation of future features.
134 <td>yes, no</td>
135 <td>no</td>
d2e1e9ea »
2009-08-31 add notes about typing.
136 </tr>
697884bd »
2009-04-21 documentation of future features.
137 <tr>
138 <th>index</th>
139 <td>whether (and how) the data is indexed</td>
83283325 »
2009-04-21 typo
140 <td>analyzed, analyzed_no_norms, no, not_analyzed, not_analyzed_no_norms</td>
697884bd »
2009-04-21 documentation of future features.
141 <td>analyzed</td>
d2e1e9ea »
2009-08-31 add notes about typing.
142 </tr>
697884bd »
2009-04-21 documentation of future features.
143 </table>
087dcec0 »
2009-04-04 update documentation.
144
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
145 <h3>The Analyzer Option</h3>
146
147 Lucene has numerous ways of converting free-form text into tokens, these classes are called Analyzer's. By default, the StandardAnalyzer is used which lower-cases all text, drops common English words ("the", "and", and so on), among other things. This processing might not always suit you, so you can choose from several others by setting the "analyzer" field to one of the following values;
148
149 <ul>
150 <li>brazilian</li>
151 <li>chinese</li>
152 <li>cjk</li>
153 <li>czech</li>
154 <li>dutch</li>
155 <li>english</li>
156 <li>french</li>
157 <li>german</li>
158 <li>keyword</li>
76d290dd »
2010-01-08 add perfield analyzer support
159 <li>perfield</li>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
160 <li>porter</li>
161 <li>russian</li>
162 <li>simple</li>
163 <li>standard</li>
164 <li>thai</li>
165 </ul>
166
167 Note: You must also supply analyzer=<analyzer_name> as a query parameter to ensure that queries are processed correctly.
168
76d290dd »
2010-01-08 add perfield analyzer support
169 The "perfield" option lets you use a different analyzer for different fields and is configured as follows;
170
171 <pre>
172 perfield:{field_name:"analyzer_name"}
173 </pre>
174
86569b1a »
2010-01-08 use 'default' consistently.
175 Unless overridden, any field name not specified will be handled by the standard analyzer. To change the default, use the special default field name;
76d290dd »
2010-01-08 add perfield analyzer support
176
177 <pre>
86569b1a »
2010-01-08 use 'default' consistently.
178 perfield:{default:"keyword"}
76d290dd »
2010-01-08 add perfield analyzer support
179 </pre>
180
087dcec0 »
2009-04-04 update documentation.
181 <h3>The Document class</h3>
182
183 You may construct a new Document instance with;
184
185 <pre>
186 var doc = new Document();
187 </pre>
188
a40523d3 »
2009-04-21 documentation of future features.
189 Data may be added to this document with the add method which takes an optional second object argument that can override any of the above default values.
087dcec0 »
2009-04-04 update documentation.
190
191 <pre>
a40523d3 »
2009-04-21 documentation of future features.
192 // Add with all the defaults.
193 doc.add("value");
194
d2e1e9ea »
2009-08-31 add notes about typing.
195 // Add a numeric field.
196 doc.add(35, {"type":"integer"});
197
46705824 »
2009-08-31 use NumericField. currently broken.
198 // Add a date field.
199 doc.add(new Date("2009-01-01"), {"type":"date"});
200
d2e1e9ea »
2009-08-31 add notes about typing.
201 // Add a date field (object must be a Date object
202
a40523d3 »
2009-04-21 documentation of future features.
203 // Add a subject field.
204 doc.add("this is the subject line.", {"field":"subject"});
9a715570 »
2009-04-05 formatting
205
a40523d3 »
2009-04-21 documentation of future features.
206 // Add but ensure it's stored.
207 doc.add("value", {"store":"yes"});
9a715570 »
2009-04-05 formatting
208
a40523d3 »
2009-04-21 documentation of future features.
209 // Add but don't analyze.
210 doc.add("don't analyze me", {"index":"not_analyzed"});
9a715570 »
2009-04-05 formatting
211
212 // Extract text from the named attachment and index it (but not store it).
a40523d3 »
2009-04-21 documentation of future features.
213 doc.attachment("attachment name", {"field":"attachments"});
087dcec0 »
2009-04-04 update documentation.
214 </pre>
215
ccb81a8a »
2009-03-20 add example transforms section.
216 <h3>Example Transforms</h3>
217
390858a2 »
2009-04-05 re-add Index Everything example.
218 <h4>Index Everything</h4>
219
220 <pre>
221 function(doc) {
7bad7dc9 »
2009-04-30 correct syntax error in JS fun.
222 var ret = new Document();
223
224 function idx(obj) {
225 for (var key in obj) {
226 switch (typeof obj[key]) {
227 case 'object':
228 idx(obj[key]);
229 break;
230 case 'function':
231 break;
232 default:
233 ret.add(obj[key]);
234 break;
235 }
236 }
237 };
238
239 idx(doc);
240
241 if (doc._attachments) {
242 for (var i in doc._attachments) {
243 ret.attachment("attachment", i);
244 }
390858a2 »
2009-04-05 re-add Index Everything example.
245 }
d2e1e9ea »
2009-08-31 add notes about typing.
246
7bad7dc9 »
2009-04-30 correct syntax error in JS fun.
247 return ret;
390858a2 »
2009-04-05 re-add Index Everything example.
248 }
249 </pre>
250
ccb81a8a »
2009-03-20 add example transforms section.
251 <h4>Index Nothing</h4>
252
253 <pre>
254 function(doc) {
255 return null;
256 }
257 </pre>
258
c207a604 »
2009-04-04 update README
259 <h4>Index Select Fields</h4>
ccb81a8a »
2009-03-20 add example transforms section.
260
261 <pre>
262 function(doc) {
c207a604 »
2009-04-04 update README
263 var result = new Document();
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
264 result.add(doc.subject, {"field":"subject", "store":"yes"});
265 result.add(doc.content, {"field":"subject"});
5cfa20cf »
2009-12-23 fix error in example
266 result.add(new Date(), {"field":"indexed_at"});
c207a604 »
2009-04-04 update README
267 return result;
ccb81a8a »
2009-03-20 add example transforms section.
268 }
269 </pre>
270
c207a604 »
2009-04-04 update README
271 <h4>Index Attachments</h4>
ccb81a8a »
2009-03-20 add example transforms section.
272
273 <pre>
274 function(doc) {
c207a604 »
2009-04-04 update README
275 var result = new Document();
276 for(var a in doc._attachments) {
244df305 »
2009-10-10 fix mistake in README
277 result.attachment(a, {"field":"attachment"});
ccb81a8a »
2009-03-20 add example transforms section.
278 }
c207a604 »
2009-04-04 update README
279 return result;
280 }
281 </pre>
282
283 <h4>A More Complex Example</h4>
284
285 <pre>
286 function(doc) {
287 var mk = function(name, value, group) {
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
288 var ret = new Document();
2946c9ae »
2009-05-06 fix example.
289 ret.add(value, {"field": group, "store":"yes"});
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
290 ret.add(group, {"field":"group", "store":"yes"});
c207a604 »
2009-04-04 update README
291 return ret;
292 };
293 if(doc.type != "reference") return null;
a313b24f »
2009-11-17 lots of stuff.
294 var ret = new Array();
c207a604 »
2009-04-04 update README
295 for(var g in doc.groups) {
a313b24f »
2009-11-17 lots of stuff.
296 ret.push(mk("library", doc.groups[g].library, g));
297 ret.push(mk("method", doc.groups[g].method, g));
298 ret.push(mk("target", doc.groups[g].target, g));
c207a604 »
2009-04-04 update README
299 }
300 return ret;
301 }
302 </pre>
b2079657 »
2009-02-14 improve README readability.
303
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
304 <h2>Attachment Indexing</h2>
305
8059ce07 »
2009-03-08 s/couchdb/couchdb-lucene
306 Couchdb-lucene uses <a href="http://lucene.apache.org/tika/">Apache Tika</a> to index attachments of the following types, assuming the correct content_type is set in couchdb;
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
307
ec94e218 »
2009-02-18 updated README.md
308 <h3>Supported Formats</h3>
309
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
310 <ul>
311 <li>Excel spreadsheets (application/vnd.ms-excel)
312 <li>HTML (text/html)
313 <li>Images (image/*)
314 <li>Java class files
315 <li>Java jar archives
316 <li>MP3 (audio/mp3)
317 <li>OpenDocument (application/vnd.oasis.opendocument.*)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
318 <li>Outlook (application/vnd.ms-outlook)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
319 <li>PDF (application/pdf)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
320 <li>Plain text (text/plain)
321 <li>Powerpoint presentations (application/vnd.ms-powerpoint)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
322 <li>RTF (application/rtf)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
323 <li>Visio (application/vnd.visio)
324 <li>Word documents (application/msword)
325 <li>XML (application/xml)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
326 </ul>
327
b2079657 »
2009-02-14 improve README readability.
328 <h1>Searching with couchdb-lucene</h1>
329
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
330 You can perform all types of queries using Lucene's default <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">query syntax</a>.
331
332 <h2>Numeric range queries</h2>
333
334 In addition to normal text-based range searches (using the "field:[lower TO upper]" syntax), couchdb-lucene all supports numeric range searches for the following types: integer, long, float, double and date. The type is automatically derived from the search terms used, as follows;
335
336 <table>
337 <tr><td>type</td><td>format</td><td>example</td></tr>
338 <tr><td>integer</td><td>[0-9]+</td><td>[0 TO 100]</td></tr>
339 <tr><td>long</td><td>[0-9]+L</td><td>[0L TO 100L]</td></tr>
340 <tr><td>float</td><td>[0-9]+.[0-9]+f</td><td>[0.0f TO 100.0f]</td></tr>
341 <tr><td>double</td><td>[0-9]+.[0-9]+</td><td>[0.0 TO 100.0]</td></tr>
342 <tr><td>date</td><td>yyyy-MM-dd or yyyy-MM-ddZZ or yyyy-MM-dd'T'HH:mm:ss or yyyy-MM-dd'T'HH:mm:ssZZ</td><td>2001-01-01 or 2001-01-01-0500 or 2000-01-01T00:00:00 or 2000-01-01T00:00:00-0500</td></tr>
343 </table>
344
345 Both the upper and lower bound must be of the same type to trigger numeric range searching. If they don't match, then a normal text-based range search is performed.
346
347 The following parameters can be passed for more sophisticated searches;
b2079657 »
2009-02-14 improve README readability.
348
349 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
350 <dt>analyzer</dt><dd>The analyzer used to convert the query string into a query object.
351 <dt>callback</dt><dd>Specify a JSONP callback wrapper. The full JSON result will be prepended with this parameter and also placed with parentheses."
71cbc0bf »
2009-08-02 correct description of debug setting.
352 <dt>debug</dt><dd>Setting this to true disables response caching (the query is executed every time) and indents the JSON response for readability.</dd>
ea19e554 »
2009-08-12 add force_json=true to force 'application/json' response type.
353 <dt>force_json<dt><dd>Usually couchdb-lucene determines the Content-Type of its response based on the presence of the Accept header. If Accept contains "application/json", you get "application/json" in the response, otherwise you get "text/plain;charset=utf8". Some tools, like JSONView for FireFox, do not send the Accept header but do render "application/json" responses if received. Setting force_json=true forces all response to "application/json" regardless of the Accept header.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
354 <dt>include_docs</dt><dd>whether to include the source docs</dd>
f9c61e32 »
2009-03-22 format README
355 <dt>limit</dt><dd>the maximum number of results to return</dd>
766d8741 »
2010-01-04 support multiple q parameters in one call.
356 <dt>q</dt><dd>the query to run (e.g, subject:hello). If not specified, the default field is searched. Multiple q parameters are permitted, the resulting JSON will be an array of responses.</dd>
f9c61e32 »
2009-03-22 format README
357 <dt>skip</dt><dd>the number of results to skip</dd>
fa0e48fa »
2009-12-24 add docs for numeric sorting too.
358 <dt>sort</dt><dd>the comma-separated fields to sort on. Prefix with / for ascending order and \ for descending order (ascending is the default if not specified). Type-specific sorting is also available by appending a : and the sort type as normal (e.g, 'sort=amount:float'). Supported types are 'float', 'double', 'int', 'long' and 'date'.</dd>
637279a5 »
2009-07-11 fix grammar in readme.
359 <dt>stale=ok</dt><dd>If you set the <i>stale</i> option to <i>ok</i>, couchdb-lucene may not perform any refreshing on the index. Searches may be faster as Lucene caches important data (especially for sorting). A query without stale=ok will use the latest data committed to the index.</dd>
ad9096f2 »
2009-02-14 tweak README.md
360 </dl>
b2079657 »
2009-02-14 improve README readability.
361
362 <i>All parameters except 'q' are optional.</i>
363
ec94e218 »
2009-02-18 updated README.md
364 <h2>Special Fields</h2>
365
366 <dl>
087dcec0 »
2009-04-04 update documentation.
367 <dt>_id</dt><dd>The _id of the document.</dd>
46a3a371 »
2009-03-08 include all DC attributes, if present.
368 </dl>
369
370 <h2>Dublin Core</h2>
371
372 All Dublin Core attributes are indexed and stored if detected in the attachment. Descriptions of the fields come from the Tika javadocs.
373
374 <dl>
6e99faa7 »
2009-05-04 dc. to _dc.
375 <dt>_dc.contributor</dt><dd> An entity responsible for making contributions to the content of the resource.</dd>
376 <dt>_dc.coverage</dt><dd>The extent or scope of the content of the resource.</dd>
377 <dt>_dc.creator</dt><dd>An entity primarily responsible for making the content of the resource.</dd>
378 <dt>_dc.date</dt><dd>A date associated with an event in the life cycle of the resource.</dd>
379 <dt>_dc.description</dt><dd>An account of the content of the resource.</dd>
380 <dt>_dc.format</dt><dd>Typically, Format may include the media-type or dimensions of the resource.</dd>
381 <dt>_dc.identifier</dt><dd>Recommended best practice is to identify the resource by means of a string or number conforming to a formal identification system.</dd>
382 <dt>_dc.language</dt><dd>A language of the intellectual content of the resource.</dd>
383 <dt>_dc.modified</dt><dd>Date on which the resource was changed.</dd>
384 <dt>_dc.publisher</dt><dd>An entity responsible for making the resource available.</dd>
385 <dt>_dc.relation</dt><dd>A reference to a related resource.</dd>
386 <dt>_dc.rights</dt><dd>Information about rights held in and over the resource.</dd>
387 <dt>_dc.source</dt><dd>A reference to a resource from which the present resource is derived.</dd>
388 <dt>_dc.subject</dt><dd>The topic of the content of the resource.</dd>
389 <dt>_dc.title</dt><dd>A name given to the resource.</dd>
390 <dt>_dc.type</dt><dd>The nature or genre of the content of the resource.</dd>
ec94e218 »
2009-02-18 updated README.md
391 </dl>
392
b2079657 »
2009-02-14 improve README readability.
393 <h2>Examples</h2>
394
395 <pre>
405e3a37 »
2009-04-29 update query urls' to reflect new syntax
396 http://localhost:5984/dbname/_fti/design_doc/view_name?q=field_name:value
397 http://localhost:5984/dbname/_fti/design_doc/view_name?q=field_name:value&sort=other_field
398 http://localhost:5984/dbname/_fti/design_doc/view_name?debug=true&sort=billing_size&q=body:document AND customer:[A TO C]
b2079657 »
2009-02-14 improve README readability.
399 </pre>
400
401 <h2>Search Results Format</h2>
402
0fcf5787 »
2009-04-26 update docs.
403 The search result contains a number of fields at the top level, in addition to your search results.
404
405 <dl>
406 <dt>etag</dt><dd>An opaque token that reflects the current version of the index. This value is also returned in an ETag header to facilitate HTTP caching.</dd>
407 <dt>fetch_duration</dt><dd>The number of milliseconds spent retrieving the documents.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
408 <dt>limit</dt><dd>The maximum number of results that can appear.</dd>
409 <dt>q</dt><dd>The query that was executed.</dd>
24591d91 »
2009-04-26 docs
410 <dt>rows</dt><dd>The search results array, described below.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
411 <dt>search_duration</dt><dd>The number of milliseconds spent performing the search.</dd>
412 <dt>skip</dt><dd>The number of initial matches that was skipped.</dd>
413 <dt>total_rows</dt><dd>The total number of matches for this query.</dd>
0fcf5787 »
2009-04-26 update docs.
414 </dl>
415
24591d91 »
2009-04-26 docs
416 <h2>The search results array</h2>
417
418 The search results arrays consists of zero, one or more objects with the following fields;
0fcf5787 »
2009-04-26 update docs.
419
420 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
421 <dt>doc</dt><dd>The original document from couch, if requested with include_docs=true</dd>
422 <dt>fields</dt><dd>All the fields that were stored with this match</dd>
0fcf5787 »
2009-04-26 update docs.
423 <dt>id</dt><dd>The unique identifier for this match.</dd>
424 <dt>score</dt><dd>The normalized score (0.0-1.0, inclusive) for this match</dd>
425 </dl>
426
fd163159 »
2009-03-07 update README.md
427 Here's an example of a JSON response without sorting;
b2079657 »
2009-02-14 improve README readability.
428
118d28eb »
2009-02-17 JSON example output.
429 <pre>
430 {
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
431 "q": "+content:enron",
fd163159 »
2009-03-07 update README.md
432 "skip": 0,
433 "limit": 2,
434 "total_rows": 176852,
435 "search_duration": 518,
436 "fetch_duration": 4,
437 "rows": [
438 {
0fcf5787 »
2009-04-26 update docs.
439 "id": "hain-m-all_documents-257.",
fd163159 »
2009-03-07 update README.md
440 "score": 1.601625680923462
441 },
442 {
0fcf5787 »
2009-04-26 update docs.
443 "id": "hain-m-notes_inbox-257.",
fd163159 »
2009-03-07 update README.md
444 "score": 1.601625680923462
445 }
118d28eb »
2009-02-17 JSON example output.
446 ]
447 }
448 </pre>
449
fd163159 »
2009-03-07 update README.md
450 And the same with sorting;
451
118d28eb »
2009-02-17 JSON example output.
452 <pre>
453 {
0fcf5787 »
2009-04-26 update docs.
454 "q": "+content:enron",
fd163159 »
2009-03-07 update README.md
455 "skip": 0,
456 "limit": 3,
457 "total_rows": 176852,
458 "search_duration": 660,
459 "fetch_duration": 4,
460 "sort_order": [
461 {
462 "field": "source",
463 "reverse": false,
464 "type": "string"
465 },
466 {
467 "reverse": false,
468 "type": "doc"
469 }
118d28eb »
2009-02-17 JSON example output.
470 ],
fd163159 »
2009-03-07 update README.md
471 "rows": [
472 {
0fcf5787 »
2009-04-26 update docs.
473 "id": "shankman-j-inbox-105.",
fd163159 »
2009-03-07 update README.md
474 "score": 0.6131107211112976,
475 "sort_order": [
476 "enron",
477 6
478 ]
479 },
480 {
0fcf5787 »
2009-04-26 update docs.
481 "id": "shankman-j-inbox-8.",
fd163159 »
2009-03-07 update README.md
482 "score": 0.7492915391921997,
483 "sort_order": [
484 "enron",
485 7
486 ]
487 },
488 {
0fcf5787 »
2009-04-26 update docs.
489 "id": "shankman-j-inbox-30.",
fd163159 »
2009-03-07 update README.md
490 "score": 0.507369875907898,
491 "sort_order": [
492 "enron",
493 8
494 ]
495 }
118d28eb »
2009-02-17 JSON example output.
496 ]
497 }
498 </pre>
499
a4aa4e14 »
2009-08-02 document Content-Type response negotiation
500 <h3>Content-Type of response</h3>
501
d2e1e9ea »
2009-08-31 add notes about typing.
502 The Content-Type of the response is negotiated via the Accept request header like CouchDB itself. If the Accept header includes "application/json" then that is also the Content-Type of the response. If not, "text/plain;charset=utf-8" is used.
a4aa4e14 »
2009-08-02 document Content-Type response negotiation
503
139a78cc »
2009-03-09 add info retrieval.
504 <h1>Fetching information about the index</h1>
505
7a12058b »
2009-04-26 docs
506 Calling couchdb-lucene without arguments returns a JSON object with information about the <i>whole</i> index.
139a78cc »
2009-03-09 add info retrieval.
507
508 <pre>
509 http://127.0.0.1:5984/enron/_fti
510 </pre>
511
512 returns;
513
514 <pre>
515 {"doc_count":517350,"doc_del_count":1,"disk_size":318543045}
516 </pre>
Something went wrong with that request. Please try again.