Skip to content
This repository
Newer
Older
100644 538 lines (425 sloc) 17.649 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
209 // Extract text from the named attachment and index it (but not store it).
a40523d3 »
2009-04-21 documentation of future features.
210 doc.attachment("attachment name", {"field":"attachments"});
087dcec0 »
2009-04-04 update documentation.
211 </pre>
212
ccb81a8a »
2009-03-20 add example transforms section.
213 <h3>Example Transforms</h3>
214
390858a2 »
2009-04-05 re-add Index Everything example.
215 <h4>Index Everything</h4>
216
217 <pre>
218 function(doc) {
7bad7dc9 »
2009-04-30 correct syntax error in JS fun.
219 var ret = new Document();
220
221 function idx(obj) {
222 for (var key in obj) {
223 switch (typeof obj[key]) {
224 case 'object':
225 idx(obj[key]);
226 break;
227 case 'function':
228 break;
229 default:
230 ret.add(obj[key]);
231 break;
232 }
233 }
234 };
235
236 idx(doc);
237
238 if (doc._attachments) {
239 for (var i in doc._attachments) {
240 ret.attachment("attachment", i);
241 }
390858a2 »
2009-04-05 re-add Index Everything example.
242 }
d2e1e9ea »
2009-08-31 add notes about typing.
243
7bad7dc9 »
2009-04-30 correct syntax error in JS fun.
244 return ret;
390858a2 »
2009-04-05 re-add Index Everything example.
245 }
246 </pre>
247
ccb81a8a »
2009-03-20 add example transforms section.
248 <h4>Index Nothing</h4>
249
250 <pre>
251 function(doc) {
252 return null;
253 }
254 </pre>
255
c207a604 »
2009-04-04 update README
256 <h4>Index Select Fields</h4>
ccb81a8a »
2009-03-20 add example transforms section.
257
258 <pre>
259 function(doc) {
c207a604 »
2009-04-04 update README
260 var result = new Document();
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
261 result.add(doc.subject, {"field":"subject", "store":"yes"});
262 result.add(doc.content, {"field":"subject"});
5cfa20cf »
2009-12-23 fix error in example
263 result.add(new Date(), {"field":"indexed_at"});
c207a604 »
2009-04-04 update README
264 return result;
ccb81a8a »
2009-03-20 add example transforms section.
265 }
266 </pre>
267
c207a604 »
2009-04-04 update README
268 <h4>Index Attachments</h4>
ccb81a8a »
2009-03-20 add example transforms section.
269
270 <pre>
271 function(doc) {
c207a604 »
2009-04-04 update README
272 var result = new Document();
273 for(var a in doc._attachments) {
244df305 »
2009-10-10 fix mistake in README
274 result.attachment(a, {"field":"attachment"});
ccb81a8a »
2009-03-20 add example transforms section.
275 }
c207a604 »
2009-04-04 update README
276 return result;
277 }
278 </pre>
279
280 <h4>A More Complex Example</h4>
281
282 <pre>
283 function(doc) {
284 var mk = function(name, value, group) {
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
285 var ret = new Document();
2946c9ae »
2009-05-06 fix example.
286 ret.add(value, {"field": group, "store":"yes"});
c6356fd5 »
2009-04-26 update README.md and TODO to reflect progress.
287 ret.add(group, {"field":"group", "store":"yes"});
c207a604 »
2009-04-04 update README
288 return ret;
289 };
290 if(doc.type != "reference") return null;
a313b24f »
2009-11-17 lots of stuff.
291 var ret = new Array();
c207a604 »
2009-04-04 update README
292 for(var g in doc.groups) {
a313b24f »
2009-11-17 lots of stuff.
293 ret.push(mk("library", doc.groups[g].library, g));
294 ret.push(mk("method", doc.groups[g].method, g));
295 ret.push(mk("target", doc.groups[g].target, g));
c207a604 »
2009-04-04 update README
296 }
297 return ret;
298 }
299 </pre>
b2079657 »
2009-02-14 improve README readability.
300
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
301 <h2>Attachment Indexing</h2>
302
8059ce07 »
2009-03-08 s/couchdb/couchdb-lucene
303 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.
304
ec94e218 »
2009-02-18 updated README.md
305 <h3>Supported Formats</h3>
306
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
307 <ul>
308 <li>Excel spreadsheets (application/vnd.ms-excel)
309 <li>HTML (text/html)
310 <li>Images (image/*)
311 <li>Java class files
312 <li>Java jar archives
313 <li>MP3 (audio/mp3)
314 <li>OpenDocument (application/vnd.oasis.opendocument.*)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
315 <li>Outlook (application/vnd.ms-outlook)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
316 <li>PDF (application/pdf)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
317 <li>Plain text (text/plain)
318 <li>Powerpoint presentations (application/vnd.ms-powerpoint)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
319 <li>RTF (application/rtf)
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
320 <li>Visio (application/vnd.visio)
321 <li>Word documents (application/msword)
322 <li>XML (application/xml)
4a600804 »
2009-02-18 use couchdb's content_type rather than auto-detect.
323 </ul>
324
b2079657 »
2009-02-14 improve README readability.
325 <h1>Searching with couchdb-lucene</h1>
326
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
327 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>.
328
329 <h2>Numeric range queries</h2>
330
bf989bc2 »
2010-01-21 make type of range query explicit.
331 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
332
333 <table>
bf989bc2 »
2010-01-21 make type of range query explicit.
334 <tr><td>type</td><td>example</td></tr>
38ef3208 »
2010-02-19 fix documentation s/integer/int
335 <tr><td>int</td><td>field&lt;int>:[0 TO 100]</td></tr>
20c9be3a »
2010-01-21 update docs on numeric range queries
336 <tr><td>long</td><td>field&lt;long>:[0 TO 100]</td></tr>
337 <tr><td>float</td><td>field&lt;float>:[0.0 TO 100.0]</td></tr>
338 <tr><td>double</td><td>field&lt;double>:[0.0 TO 100.0]</td></tr>
339 <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
340 </table>
341
460f5c6a »
2010-01-09 add example spatial/geographical query
342 An example numeric range query for spatial searching.
343
344 <pre>
1217f9f2 »
2010-01-21 update docs on numeric range queries
345 ?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
346 </pre>
347
2b14b76d »
2009-12-24 describ syntax for all forms of numeric range query
348 The following parameters can be passed for more sophisticated searches;
b2079657 »
2009-02-14 improve README readability.
349
350 <dl>
f420bf7b »
2009-08-02 support different Analyzer's at index and query time.
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>
8f30f2d8 »
2010-01-21 make typed sort the same syntax as typed range search.
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 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.
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
0cf49410 »
2010-01-10 correct info urls.
506 Calling couchdb-lucene without arguments returns a JSON object with information about the index.
139a78cc »
2009-03-09 add info retrieval.
507
508 <pre>
0cf49410 »
2010-01-10 correct info urls.
509 http://127.0.0.1:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index
139a78cc »
2009-03-09 add info retrieval.
510 </pre>
511
512 returns;
513
514 <pre>
f6ac0483 »
2010-01-10 line breaks
515 {"current":true,"disk_size":110674,"doc_count":397,"doc_del_count":0,
516 "fields":["default","number"],"last_modified":"1263066382000",
517 "optimized":true,"ref_count":2}
139a78cc »
2009-03-09 add info retrieval.
518 </pre>
8203af64 »
2010-01-10 support _optimize and _expunge calls.
519
520 <h1>Index Maintenance</h1>
521
522 For optimal query speed you can optimize your indexes. This causes the index to be rewritten into a single segment.
523
524 <pre>
b4616fb9 »
2010-01-10 support _optimize and _expunge calls. (fix documentation)
525 curl -X POST http://localhost:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index>/_optimize
8203af64 »
2010-01-10 support _optimize and _expunge calls.
526 </pre>
527
528 If you just want to expunge pending deletes, then call;
529
530 <pre>
b4616fb9 »
2010-01-10 support _optimize and _expunge calls. (fix documentation)
531 curl -X POST http://localhost:5984/&lt;db>/_fti/&lt;ddoc>/&lt;index>/_expunge
8203af64 »
2010-01-10 support _optimize and _expunge calls.
532 </pre>
6e66766f »
2010-01-31 most of index cleanup work
533
534 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;
535
536 <pre>
537 curl -X POST http://localhost:5984/&lt;db>/_fti/_cleanup
538 </pre>
Something went wrong with that request. Please try again.