Skip to content
This repository
Newer
Older
100644 541 lines (427 sloc) 17.741 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>
c47c4947 »
2010-01-25 updated README to reflect latest Python scripts settings
52 <tr><td>--local-key</td><td>The key for the local couchdb instance as known to the couchdb-lucene server</td><td>local</td></tr>
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
53 </table>
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
54
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
55 <h1>Configure couchdb-lucene</h1>
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
56
cbfe0656 »
2009-11-24 remove registry and indexkey, change output paths
57 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.
58
59 <h1>Start couchdb-lucene</h1>
60
61 To start couchdb-lucene, run;
62 <pre>
2d6180b9 »
2009-10-07 include properties file in zip. still not available to run script, th…
63 bin/run
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
64 </pre>
65
2d6180b9 »
2009-10-07 include properties file in zip. still not available to run script, th…
66 To stop couchdb-lucene, simply kill the Java process.
b047e4a2 »
2009-09-07 update README.md to reflect (future) start/stop and config changes.
67
b2079657 »
2009-02-14 improve README readability.
68 <h1>Indexing Strategy</h1>
69
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
70 <h2>Document Indexing</h2>
71
4c21806e »
2009-07-15 mention that you can return Document[] from an index function.
72 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
73
437eae90 »
2009-05-03 s/view/fulltext in README.md
74 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
75
50773667 »
2009-07-09 clarify design document and add matching query URL's.
76 Here's an complete example of a design document with couchdb-lucene features:
a2e9024b »
2009-03-06 wip
77
697884bd »
2009-04-21 documentation of future features.
78 <pre>
79 {
d1c9c80d »
2009-08-25 correct _id of first example.
80 "_id":"_design/a_design_document_with_any_name_you_like",
50773667 »
2009-07-09 clarify design document and add matching query URL's.
81 "fulltext": {
82 "by_subject": {
83 "index":"function(doc) { var ret=new Document(); ret.add(doc.subject); return ret }"
84 },
85 "by_content": {
86 "index":"function(doc) { var ret=new Document(); ret.add(doc.content); return ret }"
87 }
697884bd »
2009-04-21 documentation of future features.
88 }
89 }
90 </pre>
91
50773667 »
2009-07-09 clarify design document and add matching query URL's.
92 Here are some example URL's for the given design document;
93
94 <pre>
95 http://localhost:5984/database/_fti/lucene/by_subject?q=hello
96 http://localhost:5984/database/_fti/lucene/by_content?q=hello
97 </pre>
98
697884bd »
2009-04-21 documentation of future features.
99 A fulltext object contains multiple index view declarations. An index view consists of;
100
101 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
102 <dt>analyzer</dt><dd>(optional) The analyzer to use</dd>
103 <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.
104 <dt>index</dt><dd>The indexing function itself, documented below.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
105 </dl>
697884bd »
2009-04-21 documentation of future features.
106
107 <h3>The Defaults Object</h3>
108
109 The following indexing options can be defaulted;
110
111 <table>
112 <tr>
113 <th>name</th>
114 <th>description</th>
115 <th>available options</th>
116 <th>default</th>
117 </tr>
118 <tr>
a40523d3 »
2009-04-21 documentation of future features.
119 <th>field</th>
120 <td>the field name to index under</td>
121 <td>user-defined</td>
122 <td>default</td>
d2e1e9ea »
2009-08-31 add notes about typing.
123 </tr>
124 <tr>
125 <th>type</th>
126 <td>the type of the field</td>
38ef3208 »
2010-02-19 fix documentation s/integer/int
127 <td>date, double, float, int, long, string</td>
d2e1e9ea »
2009-08-31 add notes about typing.
128 <td>string</td>
129 </tr>
a40523d3 »
2009-04-21 documentation of future features.
130 <tr>
697884bd »
2009-04-21 documentation of future features.
131 <th>store</th>
f16fc9c8 »
2009-04-26 docs
132 <td>whether the data is stored. The value will be returned in the search result.</td>
697884bd »
2009-04-21 documentation of future features.
133 <td>yes, no</td>
134 <td>no</td>
d2e1e9ea »
2009-08-31 add notes about typing.
135 </tr>
697884bd »
2009-04-21 documentation of future features.
136 <tr>
137 <th>index</th>
138 <td>whether (and how) the data is indexed</td>
83283325 »
2009-04-21 typo
139 <td>analyzed, analyzed_no_norms, no, not_analyzed, not_analyzed_no_norms</td>
697884bd »
2009-04-21 documentation of future features.
140 <td>analyzed</td>
d2e1e9ea »
2009-08-31 add notes about typing.
141 </tr>
697884bd »
2009-04-21 documentation of future features.
142 </table>
087dcec0 »
2009-04-04 update documentation.
143
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
144 <h3>The Analyzer Option</h3>
145
146 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;
147
148 <ul>
149 <li>brazilian</li>
150 <li>chinese</li>
151 <li>cjk</li>
152 <li>czech</li>
153 <li>dutch</li>
154 <li>english</li>
155 <li>french</li>
156 <li>german</li>
157 <li>keyword</li>
76d290dd »
2010-01-08 add perfield analyzer support
158 <li>perfield</li>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
159 <li>porter</li>
160 <li>russian</li>
161 <li>simple</li>
162 <li>standard</li>
163 <li>thai</li>
164 </ul>
165
76d290dd »
2010-01-08 add perfield analyzer support
166 The "perfield" option lets you use a different analyzer for different fields and is configured as follows;
167
168 <pre>
b9ea0b23 »
2010-02-04 tidy document about analyzer
169 "analyzer":"perfield:{field_name:\"analyzer_name\"}"
76d290dd »
2010-01-08 add perfield analyzer support
170 </pre>
171
86569b1a »
2010-01-08 use 'default' consistently.
172 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
173
174 <pre>
b9ea0b23 »
2010-02-04 tidy document about analyzer
175 "analyzer":"perfield:{default:\"keyword\"}"
76d290dd »
2010-01-08 add perfield analyzer support
176 </pre>
177
087dcec0 »
2009-04-04 update documentation.
178 <h3>The Document class</h3>
179
180 You may construct a new Document instance with;
181
182 <pre>
183 var doc = new Document();
184 </pre>
185
a40523d3 »
2009-04-21 documentation of future features.
186 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.
187
188 <pre>
a40523d3 »
2009-04-21 documentation of future features.
189 // Add with all the defaults.
190 doc.add("value");
191
d2e1e9ea »
2009-08-31 add notes about typing.
192 // Add a numeric field.
38ef3208 »
2010-02-19 fix documentation s/integer/int
193 doc.add(35, {"type":"int"});
d2e1e9ea »
2009-08-31 add notes about typing.
194
46705824 »
2009-08-31 use NumericField. currently broken.
195 // Add a date field.
196 doc.add(new Date("2009-01-01"), {"type":"date"});
197
d2e1e9ea »
2009-08-31 add notes about typing.
198 // Add a date field (object must be a Date object
199
a40523d3 »
2009-04-21 documentation of future features.
200 // Add a subject field.
201 doc.add("this is the subject line.", {"field":"subject"});
9a715570 »
2009-04-05 formatting
202
a40523d3 »
2009-04-21 documentation of future features.
203 // Add but ensure it's stored.
204 doc.add("value", {"store":"yes"});
9a715570 »
2009-04-05 formatting
205
a40523d3 »
2009-04-21 documentation of future features.
206 // Add but don't analyze.
207 doc.add("don't analyze me", {"index":"not_analyzed"});
9a715570 »
2009-04-05 formatting
208
fae7be0e »
2010-03-26 add example for attachment with default field.
209 // Extract text from the named attachment and index it.
210 doc.attachment("attachment name");
211
212 // Extract text from the named attachment and index it to a separate field
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
bf989bc2 »
2010-01-21 make type of range query explicit.
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: int, long, float, double and date. The type is specified after the field name, as follows;
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
335
336 <table>
bf989bc2 »
2010-01-21 make type of range query explicit.
337 <tr><td>type</td><td>example</td></tr>
38ef3208 »
2010-02-19 fix documentation s/integer/int
338 <tr><td>int</td><td>field&lt;int>:[0 TO 100]</td></tr>
20c9be3a »
2010-01-21 update docs on numeric range queries
339 <tr><td>long</td><td>field&lt;long>:[0 TO 100]</td></tr>
340 <tr><td>float</td><td>field&lt;float>:[0.0 TO 100.0]</td></tr>
341 <tr><td>double</td><td>field&lt;double>:[0.0 TO 100.0]</td></tr>
342 <tr><td>date</td><td>field&lt;date>:[2001-01-01 TO 2010-01-01] or field&lt;date>:[2000-01-01T00:00:00-0500 TO 2010-01-01T00:00:00-0500]</td></tr>
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
343 </table>
344
460f5c6a »
2010-01-09 add example spatial/geographical query
345 An example numeric range query for spatial searching.
346
347 <pre>
1217f9f2 »
2010-01-21 update docs on numeric range queries
348 ?q=pizza AND lat&lt;double>:[51.4707 TO 51.5224] AND long&lt;double>:[-0.6622 TO -0.5775]
460f5c6a »
2010-01-09 add example spatial/geographical query
349 </pre>
350
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
351 The following parameters can be passed for more sophisticated searches;
b2079657 »
2009-02-14 improve README readability.
352
353 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
354 <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.
355 <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.
356 <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.
357 <dt>include_docs</dt><dd>whether to include the source docs</dd>
f9c61e32 »
2009-03-22 format README
358 <dt>limit</dt><dd>the maximum number of results to return</dd>
766d8741 »
2010-01-04 support multiple q parameters in one call.
359 <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
360 <dt>skip</dt><dd>the number of results to skip</dd>
8f30f2d8 »
2010-01-21 make typed sort the same syntax as typed range search.
361 <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 the type between angle brackets (e.g, 'sort=amount<float>'). Supported types are 'float', 'double', 'int', 'long' and 'date'.</dd>
637279a5 »
2009-07-11 fix grammar in readme.
362 <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
363 </dl>
b2079657 »
2009-02-14 improve README readability.
364
365 <i>All parameters except 'q' are optional.</i>
366
ec94e218 »
2009-02-18 updated README.md
367 <h2>Special Fields</h2>
368
369 <dl>
087dcec0 »
2009-04-04 update documentation.
370 <dt>_id</dt><dd>The _id of the document.</dd>
46a3a371 »
2009-03-08 include all DC attributes, if present.
371 </dl>
372
373 <h2>Dublin Core</h2>
374
375 All Dublin Core attributes are indexed and stored if detected in the attachment. Descriptions of the fields come from the Tika javadocs.
376
377 <dl>
6e99faa7 »
2009-05-04 dc. to _dc.
378 <dt>_dc.contributor</dt><dd> An entity responsible for making contributions to the content of the resource.</dd>
379 <dt>_dc.coverage</dt><dd>The extent or scope of the content of the resource.</dd>
380 <dt>_dc.creator</dt><dd>An entity primarily responsible for making the content of the resource.</dd>
381 <dt>_dc.date</dt><dd>A date associated with an event in the life cycle of the resource.</dd>
382 <dt>_dc.description</dt><dd>An account of the content of the resource.</dd>
383 <dt>_dc.format</dt><dd>Typically, Format may include the media-type or dimensions of the resource.</dd>
384 <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>
385 <dt>_dc.language</dt><dd>A language of the intellectual content of the resource.</dd>
386 <dt>_dc.modified</dt><dd>Date on which the resource was changed.</dd>
387 <dt>_dc.publisher</dt><dd>An entity responsible for making the resource available.</dd>
388 <dt>_dc.relation</dt><dd>A reference to a related resource.</dd>
389 <dt>_dc.rights</dt><dd>Information about rights held in and over the resource.</dd>
390 <dt>_dc.source</dt><dd>A reference to a resource from which the present resource is derived.</dd>
391 <dt>_dc.subject</dt><dd>The topic of the content of the resource.</dd>
392 <dt>_dc.title</dt><dd>A name given to the resource.</dd>
393 <dt>_dc.type</dt><dd>The nature or genre of the content of the resource.</dd>
ec94e218 »
2009-02-18 updated README.md
394 </dl>
395
b2079657 »
2009-02-14 improve README readability.
396 <h2>Examples</h2>
397
398 <pre>
405e3a37 »
2009-04-29 update query urls' to reflect new syntax
399 http://localhost:5984/dbname/_fti/design_doc/view_name?q=field_name:value
400 http://localhost:5984/dbname/_fti/design_doc/view_name?q=field_name:value&sort=other_field
401 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.
402 </pre>
403
404 <h2>Search Results Format</h2>
405
0fcf5787 »
2009-04-26 update docs.
406 The search result contains a number of fields at the top level, in addition to your search results.
407
408 <dl>
409 <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>
410 <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.
411 <dt>limit</dt><dd>The maximum number of results that can appear.</dd>
412 <dt>q</dt><dd>The query that was executed.</dd>
24591d91 »
2009-04-26 docs
413 <dt>rows</dt><dd>The search results array, described below.</dd>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
414 <dt>search_duration</dt><dd>The number of milliseconds spent performing the search.</dd>
415 <dt>skip</dt><dd>The number of initial matches that was skipped.</dd>
416 <dt>total_rows</dt><dd>The total number of matches for this query.</dd>
0fcf5787 »
2009-04-26 update docs.
417 </dl>
418
24591d91 »
2009-04-26 docs
419 <h2>The search results array</h2>
420
421 The search results arrays consists of zero, one or more objects with the following fields;
0fcf5787 »
2009-04-26 update docs.
422
423 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
424 <dt>doc</dt><dd>The original document from couch, if requested with include_docs=true</dd>
425 <dt>fields</dt><dd>All the fields that were stored with this match</dd>
0fcf5787 »
2009-04-26 update docs.
426 <dt>id</dt><dd>The unique identifier for this match.</dd>
427 <dt>score</dt><dd>The normalized score (0.0-1.0, inclusive) for this match</dd>
428 </dl>
429
fd163159 »
2009-03-07 update README.md
430 Here's an example of a JSON response without sorting;
b2079657 »
2009-02-14 improve README readability.
431
118d28eb »
2009-02-17 JSON example output.
432 <pre>
433 {
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
434 "q": "+content:enron",
fd163159 »
2009-03-07 update README.md
435 "skip": 0,
436 "limit": 2,
437 "total_rows": 176852,
438 "search_duration": 518,
439 "fetch_duration": 4,
440 "rows": [
441 {
0fcf5787 »
2009-04-26 update docs.
442 "id": "hain-m-all_documents-257.",
fd163159 »
2009-03-07 update README.md
443 "score": 1.601625680923462
444 },
445 {
0fcf5787 »
2009-04-26 update docs.
446 "id": "hain-m-notes_inbox-257.",
fd163159 »
2009-03-07 update README.md
447 "score": 1.601625680923462
448 }
118d28eb »
2009-02-17 JSON example output.
449 ]
450 }
451 </pre>
452
fd163159 »
2009-03-07 update README.md
453 And the same with sorting;
454
118d28eb »
2009-02-17 JSON example output.
455 <pre>
456 {
0fcf5787 »
2009-04-26 update docs.
457 "q": "+content:enron",
fd163159 »
2009-03-07 update README.md
458 "skip": 0,
459 "limit": 3,
460 "total_rows": 176852,
461 "search_duration": 660,
462 "fetch_duration": 4,
463 "sort_order": [
464 {
465 "field": "source",
466 "reverse": false,
467 "type": "string"
468 },
469 {
470 "reverse": false,
471 "type": "doc"
472 }
118d28eb »
2009-02-17 JSON example output.
473 ],
fd163159 »
2009-03-07 update README.md
474 "rows": [
475 {
0fcf5787 »
2009-04-26 update docs.
476 "id": "shankman-j-inbox-105.",
fd163159 »
2009-03-07 update README.md
477 "score": 0.6131107211112976,
478 "sort_order": [
479 "enron",
480 6
481 ]
482 },
483 {
0fcf5787 »
2009-04-26 update docs.
484 "id": "shankman-j-inbox-8.",
fd163159 »
2009-03-07 update README.md
485 "score": 0.7492915391921997,
486 "sort_order": [
487 "enron",
488 7
489 ]
490 },
491 {
0fcf5787 »
2009-04-26 update docs.
492 "id": "shankman-j-inbox-30.",
fd163159 »
2009-03-07 update README.md
493 "score": 0.507369875907898,
494 "sort_order": [
495 "enron",
496 8
497 ]
498 }
118d28eb »
2009-02-17 JSON example output.
499 ]
500 }
501 </pre>
502
a4aa4e14 »
2009-08-02 document Content-Type response negotiation
503 <h3>Content-Type of response</h3>
504
d2e1e9ea »
2009-08-31 add notes about typing.
505 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
506
139a78cc »
2009-03-09 add info retrieval.
507 <h1>Fetching information about the index</h1>
508
0cf49410 »
2010-01-10 correct info urls.
509 Calling couchdb-lucene without arguments returns a JSON object with information about the index.
139a78cc »
2009-03-09 add info retrieval.
510
511 <pre>
0cf49410 »
2010-01-10 correct info urls.
512 http://127.0.0.1:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index
139a78cc »
2009-03-09 add info retrieval.
513 </pre>
514
515 returns;
516
517 <pre>
f6ac0483 »
2010-01-10 line breaks
518 {"current":true,"disk_size":110674,"doc_count":397,"doc_del_count":0,
519 "fields":["default","number"],"last_modified":"1263066382000",
520 "optimized":true,"ref_count":2}
139a78cc »
2009-03-09 add info retrieval.
521 </pre>
8203af64 »
2010-01-10 support _optimize and _expunge calls.
522
523 <h1>Index Maintenance</h1>
524
525 For optimal query speed you can optimize your indexes. This causes the index to be rewritten into a single segment.
526
527 <pre>
b4616fb9 »
2010-01-10 support _optimize and _expunge calls. (fix documentation)
528 curl -X POST http://localhost:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index>/_optimize
8203af64 »
2010-01-10 support _optimize and _expunge calls.
529 </pre>
530
531 If you just want to expunge pending deletes, then call;
532
533 <pre>
b4616fb9 »
2010-01-10 support _optimize and _expunge calls. (fix documentation)
534 curl -X POST http://localhost:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index>/_expunge
8203af64 »
2010-01-10 support _optimize and _expunge calls.
535 </pre>
6e66766f »
2010-01-31 most of index cleanup work
536
537 If you recreate databases or frequently change your fulltext functions, you will probably have old indexes lying around on disk. To remove all of them, call;
538
539 <pre>
540 curl -X POST http://localhost:5984/&lt;db>/_fti/_cleanup
541 </pre>
Something went wrong with that request. Please try again.