Skip to content
Newer
Older
100644 545 lines (430 sloc) 17.3 KB
6d1c074 add notes about version compatibility.
Robert Newson authored Sep 15, 2009
1 <h1>Version Compatibility</h1>
2
3 <table>
4 <tr><th>CouchDB</th><th>couchdb-lucene</th></tr>
5 <tr><td>0.9.1, 0.10</td><td>0.4</td></tr>
5cd5577 0.11 is now released.
Robert Newson authored Apr 12, 2010
6 <tr><td>0.11</td><td>0.4-maint (0.4 with patch for trunk compatibility)</td></tr>
79285e8 remove warning about 0.5 now it's out.
Robert Newson authored Apr 17, 2010
7 <tr><td>0.10.x and 0.11.x</td><td>0.5.x</td></tr>
6d1c074 add notes about version compatibility.
Robert Newson authored Sep 15, 2009
8 </table>
9
9084540 add breaking changes section.
Robert Newson authored Apr 17, 2010
10 <h1>Breaking Changes</h1>
11
12 <ul>
79285e8 remove warning about 0.5 now it's out.
Robert Newson authored Apr 17, 2010
13 <li>couchdb-lucene 0.5.x runs as a standalone daemon (0.4 was run directly by couchdb).
9084540 add breaking changes section.
Robert Newson authored Apr 17, 2010
14 <li>URL's now require the full design document id (where you would say "foo", you must now say "_design/foo").
15 </ul>
16
c6356fd update README.md and TODO to reflect progress.
Robert Newson authored Apr 26, 2009
17 <h1>Issue Tracking</h1>
a785480 lighthouse sucks at formatting anything, abandon ship.
Robert Newson authored May 9, 2009
18
7a0d1d3 lighthouse sucks at formatting anything, abandon ship.
Robert Newson authored May 9, 2009
19 Issue tracking at <a href="http://github.com/rnewson/couchdb-lucene/issues">github</a>.
5d4e56a update readme.
Robert Newson authored Mar 6, 2009
20
7dc5bac reorg begins.
Robert Newson authored Sep 2, 2009
21 <h1>Minimum System Requirements</h1>
ef3f787 add sysreq for Sun JDK.
Robert Newson authored Apr 6, 2009
22
796a42b jdk 5 compatibility for readme.
Robert Newson authored Oct 8, 2009
23 Java 1.5 (or above) is required; the Sun version is recommended as it's regularly tested against.
ef3f787 add sysreq for Sun JDK.
Robert Newson authored Apr 6, 2009
24
5220b65 tweak README.md
Robert Newson authored Feb 14, 2009
25 <h1>Build couchdb-lucene</h1>
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
26
27 <ol>
28 <li>Install Maven 2.
29 <li>checkout repository
30 <li>type 'mvn'
31 <li>configure couchdb (see below)
32 </ol>
33
2d6180b include properties file in zip. still not available to run script, th…
Robert Newson authored Oct 7, 2009
34 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.
35
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
36 <h1>Configure CouchDB</h1>
37
38 <pre>
0563120 fixes.
Robert Newson authored Mar 7, 2009
39 [couchdb]
40 os_process_timeout=60000 ; increase the timeout from 5 seconds.
41
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
42 [external]
5675f7a fix path
Robert Newson authored Jan 7, 2010
43 fti=/path/to/python /path/to/couchdb-lucene/tools/couchdb-external-hook.py
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
44
45 [httpd_db_handlers]
46 _fti = {couch_httpd_external, handle_external_req, <<"fti">>}
47 </pre>
48
cbfe065 remove registry and indexkey, change output paths
Robert Newson authored Nov 24, 2009
49 <h2>Hook options</h2>
50
51 <table>
52 <tr><th>Option</th><th>Meaning</th><th>Default Value</th></tr>
53 <tr><td>--remote-host</td><td>The hostname of the couchdb-lucene server</td><td>localhost</td></tr>
54 <tr><td>--remote-port</td><td>The port of the couchdb-lucene server</td><td>5985</td></tr>
c47c494 updated README to reflect latest Python scripts settings
Robert Newson authored Jan 25, 2010
55 <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>
cbfe065 remove registry and indexkey, change output paths
Robert Newson authored Nov 24, 2009
56 </table>
b047e4a update README.md to reflect (future) start/stop and config changes.
Robert Newson authored Sep 7, 2009
57
cbfe065 remove registry and indexkey, change output paths
Robert Newson authored Nov 24, 2009
58 <h1>Configure couchdb-lucene</h1>
b047e4a update README.md to reflect (future) start/stop and config changes.
Robert Newson authored Sep 7, 2009
59
cbfe065 remove registry and indexkey, change output paths
Robert Newson authored Nov 24, 2009
60 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.
b047e4a update README.md to reflect (future) start/stop and config changes.
Robert Newson authored Sep 7, 2009
61
62 <h1>Start couchdb-lucene</h1>
63
64 To start couchdb-lucene, run;
65 <pre>
2d6180b include properties file in zip. still not available to run script, th…
Robert Newson authored Oct 7, 2009
66 bin/run
b047e4a update README.md to reflect (future) start/stop and config changes.
Robert Newson authored Sep 7, 2009
67 </pre>
68
2d6180b include properties file in zip. still not available to run script, th…
Robert Newson authored Oct 7, 2009
69 To stop couchdb-lucene, simply kill the Java process.
b047e4a update README.md to reflect (future) start/stop and config changes.
Robert Newson authored Sep 7, 2009
70
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
71 <h1>Indexing Strategy</h1>
72
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
73 <h2>Document Indexing</h2>
74
4c21806 mention that you can return Document[] from an index function.
Robert Newson authored Jul 15, 2009
75 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.
a2e9024 wip
Robert Newson authored Mar 6, 2009
76
437eae9 s/view/fulltext in README.md
Robert Newson authored May 3, 2009
77 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.
c207a60 update README
Robert Newson authored Apr 4, 2009
78
5077366 clarify design document and add matching query URL's.
Robert Newson authored Jul 9, 2009
79 Here's an complete example of a design document with couchdb-lucene features:
a2e9024 wip
Robert Newson authored Mar 6, 2009
80
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
81 <pre>
82 {
3d2fb72 fix example in README.
Robert Newson authored Apr 17, 2010
83 "_id":"_design/foo",
5077366 clarify design document and add matching query URL's.
Robert Newson authored Jul 9, 2009
84 "fulltext": {
85 "by_subject": {
86 "index":"function(doc) { var ret=new Document(); ret.add(doc.subject); return ret }"
87 },
88 "by_content": {
89 "index":"function(doc) { var ret=new Document(); ret.add(doc.content); return ret }"
90 }
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
91 }
92 }
93 </pre>
94
5077366 clarify design document and add matching query URL's.
Robert Newson authored Jul 9, 2009
95 Here are some example URL's for the given design document;
96
97 <pre>
6b73dc6 commit to _design/foo in paths, use regexp to be sure.
Robert Newson authored Apr 17, 2010
98 http://localhost:5984/database/_fti/_design/foo/by_subject?q=hello
99 http://localhost:5984/database/_fti/_design/foo/by_content?q=hello
5077366 clarify design document and add matching query URL's.
Robert Newson authored Jul 9, 2009
100 </pre>
101
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
102 A fulltext object contains multiple index view declarations. An index view consists of;
103
104 <dl>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
105 <dt>analyzer</dt><dd>(optional) The analyzer to use</dd>
106 <dt>defaults</dt><dd>(optional) The default for numerous indexing options can be overridden here. A full list of options follows.</dd>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
107 <dt>index</dt><dd>The indexing function itself, documented below.</dd>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
108 </dl>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
109
110 <h3>The Defaults Object</h3>
111
112 The following indexing options can be defaulted;
113
114 <table>
115 <tr>
116 <th>name</th>
117 <th>description</th>
118 <th>available options</th>
119 <th>default</th>
120 </tr>
121 <tr>
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
122 <th>field</th>
123 <td>the field name to index under</td>
124 <td>user-defined</td>
125 <td>default</td>
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
126 </tr>
127 <tr>
128 <th>type</th>
129 <td>the type of the field</td>
38ef320 fix documentation s/integer/int
Robert Newson authored Feb 19, 2010
130 <td>date, double, float, int, long, string</td>
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
131 <td>string</td>
132 </tr>
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
133 <tr>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
134 <th>store</th>
f16fc9c docs
Robert Newson authored Apr 26, 2009
135 <td>whether the data is stored. The value will be returned in the search result.</td>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
136 <td>yes, no</td>
137 <td>no</td>
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
138 </tr>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
139 <tr>
140 <th>index</th>
141 <td>whether (and how) the data is indexed</td>
8328332 typo
Robert Newson authored Apr 21, 2009
142 <td>analyzed, analyzed_no_norms, no, not_analyzed, not_analyzed_no_norms</td>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
143 <td>analyzed</td>
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
144 </tr>
697884b documentation of future features.
Robert Newson authored Apr 21, 2009
145 </table>
087dcec update documentation.
Robert Newson authored Apr 4, 2009
146
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
147 <h3>The Analyzer Option</h3>
148
149 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;
150
151 <ul>
152 <li>brazilian</li>
153 <li>chinese</li>
154 <li>cjk</li>
155 <li>czech</li>
156 <li>dutch</li>
157 <li>english</li>
158 <li>french</li>
159 <li>german</li>
160 <li>keyword</li>
76d290d add perfield analyzer support
Robert Newson authored Jan 8, 2010
161 <li>perfield</li>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
162 <li>porter</li>
163 <li>russian</li>
164 <li>simple</li>
165 <li>standard</li>
166 <li>thai</li>
167 </ul>
168
76d290d add perfield analyzer support
Robert Newson authored Jan 8, 2010
169 The "perfield" option lets you use a different analyzer for different fields and is configured as follows;
170
171 <pre>
b9ea0b2 tidy document about analyzer
Robert Newson authored Feb 4, 2010
172 "analyzer":"perfield:{field_name:\"analyzer_name\"}"
76d290d add perfield analyzer support
Robert Newson authored Jan 8, 2010
173 </pre>
174
86569b1 use 'default' consistently.
Robert Newson authored Jan 8, 2010
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;
76d290d add perfield analyzer support
Robert Newson authored Jan 8, 2010
176
177 <pre>
b9ea0b2 tidy document about analyzer
Robert Newson authored Feb 4, 2010
178 "analyzer":"perfield:{default:\"keyword\"}"
76d290d add perfield analyzer support
Robert Newson authored Jan 8, 2010
179 </pre>
180
087dcec update documentation.
Robert Newson authored Apr 4, 2009
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
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
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.
087dcec update documentation.
Robert Newson authored Apr 4, 2009
190
191 <pre>
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
192 // Add with all the defaults.
193 doc.add("value");
194
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
195 // Add a numeric field.
38ef320 fix documentation s/integer/int
Robert Newson authored Feb 19, 2010
196 doc.add(35, {"type":"int"});
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
197
4670582 use NumericField. currently broken.
Robert Newson authored Aug 31, 2009
198 // Add a date field.
199 doc.add(new Date("2009-01-01"), {"type":"date"});
200
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
201 // Add a date field (object must be a Date object
202
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
203 // Add a subject field.
204 doc.add("this is the subject line.", {"field":"subject"});
9a71557 formatting
Robert Newson authored Apr 5, 2009
205
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
206 // Add but ensure it's stored.
207 doc.add("value", {"store":"yes"});
9a71557 formatting
Robert Newson authored Apr 4, 2009
208
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
209 // Add but don't analyze.
210 doc.add("don't analyze me", {"index":"not_analyzed"});
9a71557 formatting
Robert Newson authored Apr 4, 2009
211
fae7be0 add example for attachment with default field.
Robert Newson authored Mar 26, 2010
212 // Extract text from the named attachment and index it.
213 doc.attachment("attachment name");
214
215 // Extract text from the named attachment and index it to a separate field
a40523d documentation of future features.
Robert Newson authored Apr 21, 2009
216 doc.attachment("attachment name", {"field":"attachments"});
087dcec update documentation.
Robert Newson authored Apr 4, 2009
217 </pre>
218
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
219 <h3>Example Transforms</h3>
220
390858a re-add Index Everything example.
Robert Newson authored Apr 5, 2009
221 <h4>Index Everything</h4>
222
223 <pre>
224 function(doc) {
7bad7dc correct syntax error in JS fun.
Robert Newson authored Apr 30, 2009
225 var ret = new Document();
226
227 function idx(obj) {
228 for (var key in obj) {
229 switch (typeof obj[key]) {
230 case 'object':
231 idx(obj[key]);
232 break;
233 case 'function':
234 break;
235 default:
236 ret.add(obj[key]);
237 break;
238 }
239 }
240 };
241
242 idx(doc);
243
244 if (doc._attachments) {
245 for (var i in doc._attachments) {
246 ret.attachment("attachment", i);
247 }
390858a re-add Index Everything example.
Robert Newson authored Apr 5, 2009
248 }
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
249
7bad7dc correct syntax error in JS fun.
Robert Newson authored Apr 30, 2009
250 return ret;
390858a re-add Index Everything example.
Robert Newson authored Apr 5, 2009
251 }
252 </pre>
253
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
254 <h4>Index Nothing</h4>
255
256 <pre>
257 function(doc) {
258 return null;
259 }
260 </pre>
261
c207a60 update README
Robert Newson authored Apr 4, 2009
262 <h4>Index Select Fields</h4>
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
263
264 <pre>
265 function(doc) {
c207a60 update README
Robert Newson authored Apr 4, 2009
266 var result = new Document();
c6356fd update README.md and TODO to reflect progress.
Robert Newson authored Apr 26, 2009
267 result.add(doc.subject, {"field":"subject", "store":"yes"});
268 result.add(doc.content, {"field":"subject"});
5cfa20c fix error in example
Robert Newson authored Dec 23, 2009
269 result.add(new Date(), {"field":"indexed_at"});
c207a60 update README
Robert Newson authored Apr 4, 2009
270 return result;
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
271 }
272 </pre>
273
c207a60 update README
Robert Newson authored Apr 4, 2009
274 <h4>Index Attachments</h4>
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
275
276 <pre>
277 function(doc) {
c207a60 update README
Robert Newson authored Apr 4, 2009
278 var result = new Document();
279 for(var a in doc._attachments) {
244df30 fix mistake in README
Robert Newson authored Oct 10, 2009
280 result.attachment(a, {"field":"attachment"});
ccb81a8 add example transforms section.
Robert Newson authored Mar 20, 2009
281 }
c207a60 update README
Robert Newson authored Apr 4, 2009
282 return result;
283 }
284 </pre>
285
286 <h4>A More Complex Example</h4>
287
288 <pre>
289 function(doc) {
290 var mk = function(name, value, group) {
c6356fd update README.md and TODO to reflect progress.
Robert Newson authored Apr 26, 2009
291 var ret = new Document();
2946c9a fix example.
Robert Newson authored May 6, 2009
292 ret.add(value, {"field": group, "store":"yes"});
c6356fd update README.md and TODO to reflect progress.
Robert Newson authored Apr 26, 2009
293 ret.add(group, {"field":"group", "store":"yes"});
c207a60 update README
Robert Newson authored Apr 4, 2009
294 return ret;
295 };
296 if(doc.type != "reference") return null;
a313b24 lots of stuff.
Robert Newson authored Nov 17, 2009
297 var ret = new Array();
c207a60 update README
Robert Newson authored Apr 4, 2009
298 for(var g in doc.groups) {
a313b24 lots of stuff.
Robert Newson authored Nov 17, 2009
299 ret.push(mk("library", doc.groups[g].library, g));
300 ret.push(mk("method", doc.groups[g].method, g));
301 ret.push(mk("target", doc.groups[g].target, g));
c207a60 update README
Robert Newson authored Apr 4, 2009
302 }
303 return ret;
304 }
305 </pre>
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
306
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
307 <h2>Attachment Indexing</h2>
308
8059ce0 s/couchdb/couchdb-lucene
Robert Newson authored Mar 8, 2009
309 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;
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
310
ec94e21 updated README.md
Robert Newson authored Feb 18, 2009
311 <h3>Supported Formats</h3>
312
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
313 <ul>
314 <li>Excel spreadsheets (application/vnd.ms-excel)
315 <li>HTML (text/html)
316 <li>Images (image/*)
317 <li>Java class files
318 <li>Java jar archives
319 <li>MP3 (audio/mp3)
320 <li>OpenDocument (application/vnd.oasis.opendocument.*)
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
321 <li>Outlook (application/vnd.ms-outlook)
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
322 <li>PDF (application/pdf)
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
323 <li>Plain text (text/plain)
324 <li>Powerpoint presentations (application/vnd.ms-powerpoint)
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
325 <li>RTF (application/rtf)
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
326 <li>Visio (application/vnd.visio)
327 <li>Word documents (application/msword)
328 <li>XML (application/xml)
4a60080 use couchdb's content_type rather than auto-detect.
Robert Newson authored Feb 18, 2009
329 </ul>
330
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
331 <h1>Searching with couchdb-lucene</h1>
332
2b14b76 describ syntax for all forms of numeric range query
Robert Newson authored Dec 24, 2009
333 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>.
334
335 <h2>Numeric range queries</h2>
336
bf989bc make type of range query explicit.
Robert Newson authored Jan 21, 2010
337 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;
2b14b76 describ syntax for all forms of numeric range query
Robert Newson authored Dec 24, 2009
338
339 <table>
bf989bc make type of range query explicit.
Robert Newson authored Jan 21, 2010
340 <tr><td>type</td><td>example</td></tr>
38ef320 fix documentation s/integer/int
Robert Newson authored Feb 19, 2010
341 <tr><td>int</td><td>field&lt;int>:[0 TO 100]</td></tr>
20c9be3 update docs on numeric range queries
Robert Newson authored Jan 21, 2010
342 <tr><td>long</td><td>field&lt;long>:[0 TO 100]</td></tr>
343 <tr><td>float</td><td>field&lt;float>:[0.0 TO 100.0]</td></tr>
344 <tr><td>double</td><td>field&lt;double>:[0.0 TO 100.0]</td></tr>
345 <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>
2b14b76 describ syntax for all forms of numeric range query
Robert Newson authored Dec 24, 2009
346 </table>
347
460f5c6 add example spatial/geographical query
Robert Newson authored Jan 9, 2010
348 An example numeric range query for spatial searching.
349
350 <pre>
1217f9f update docs on numeric range queries
Robert Newson authored Jan 21, 2010
351 ?q=pizza AND lat&lt;double>:[51.4707 TO 51.5224] AND long&lt;double>:[-0.6622 TO -0.5775]
460f5c6 add example spatial/geographical query
Robert Newson authored Jan 9, 2010
352 </pre>
353
2b14b76 describ syntax for all forms of numeric range query
Robert Newson authored Dec 24, 2009
354 The following parameters can be passed for more sophisticated searches;
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
355
356 <dl>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
357 <dt>callback</dt><dd>Specify a JSONP callback wrapper. The full JSON result will be prepended with this parameter and also placed with parentheses."
71cbc0b correct description of debug setting.
Robert Newson authored Aug 2, 2009
358 <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>
ea19e55 add force_json=true to force 'application/json' response type.
Robert Newson authored Aug 12, 2009
359 <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>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
360 <dt>include_docs</dt><dd>whether to include the source docs</dd>
f9c61e3 format README
Robert Newson authored Mar 22, 2009
361 <dt>limit</dt><dd>the maximum number of results to return</dd>
766d874 support multiple q parameters in one call.
Robert Newson authored Jan 4, 2010
362 <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>
f9c61e3 format README
Robert Newson authored Mar 22, 2009
363 <dt>skip</dt><dd>the number of results to skip</dd>
8f30f2d make typed sort the same syntax as typed range search.
Robert Newson authored Jan 21, 2010
364 <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>
637279a fix grammar in readme.
Robert Newson authored Jul 11, 2009
365 <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>
ad9096f tweak README.md
Robert Newson authored Feb 14, 2009
366 </dl>
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
367
368 <i>All parameters except 'q' are optional.</i>
369
ec94e21 updated README.md
Robert Newson authored Feb 18, 2009
370 <h2>Special Fields</h2>
371
372 <dl>
087dcec update documentation.
Robert Newson authored Apr 4, 2009
373 <dt>_id</dt><dd>The _id of the document.</dd>
46a3a37 include all DC attributes, if present.
Robert Newson authored Mar 8, 2009
374 </dl>
375
376 <h2>Dublin Core</h2>
377
378 All Dublin Core attributes are indexed and stored if detected in the attachment. Descriptions of the fields come from the Tika javadocs.
379
380 <dl>
6e99faa dc. to _dc.
Robert Newson authored May 4, 2009
381 <dt>_dc.contributor</dt><dd> An entity responsible for making contributions to the content of the resource.</dd>
382 <dt>_dc.coverage</dt><dd>The extent or scope of the content of the resource.</dd>
383 <dt>_dc.creator</dt><dd>An entity primarily responsible for making the content of the resource.</dd>
384 <dt>_dc.date</dt><dd>A date associated with an event in the life cycle of the resource.</dd>
385 <dt>_dc.description</dt><dd>An account of the content of the resource.</dd>
386 <dt>_dc.format</dt><dd>Typically, Format may include the media-type or dimensions of the resource.</dd>
387 <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>
388 <dt>_dc.language</dt><dd>A language of the intellectual content of the resource.</dd>
389 <dt>_dc.modified</dt><dd>Date on which the resource was changed.</dd>
390 <dt>_dc.publisher</dt><dd>An entity responsible for making the resource available.</dd>
391 <dt>_dc.relation</dt><dd>A reference to a related resource.</dd>
392 <dt>_dc.rights</dt><dd>Information about rights held in and over the resource.</dd>
393 <dt>_dc.source</dt><dd>A reference to a resource from which the present resource is derived.</dd>
394 <dt>_dc.subject</dt><dd>The topic of the content of the resource.</dd>
395 <dt>_dc.title</dt><dd>A name given to the resource.</dd>
396 <dt>_dc.type</dt><dd>The nature or genre of the content of the resource.</dd>
ec94e21 updated README.md
Robert Newson authored Feb 18, 2009
397 </dl>
398
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
399 <h2>Examples</h2>
400
401 <pre>
6b73dc6 commit to _design/foo in paths, use regexp to be sure.
Robert Newson authored Apr 17, 2010
402 http://localhost:5984/dbname/_fti/_design/foo/view_name?q=field_name:value
403 http://localhost:5984/dbname/_fti/_design/foo/view_name?q=field_name:value&sort=other_field
404 http://localhost:5984/dbname/_fti/_design/foo/view_name?debug=true&sort=billing_size&q=body:document AND customer:[A TO C]
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
405 </pre>
406
407 <h2>Search Results Format</h2>
408
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
409 The search result contains a number of fields at the top level, in addition to your search results.
410
411 <dl>
412 <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>
413 <dt>fetch_duration</dt><dd>The number of milliseconds spent retrieving the documents.</dd>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
414 <dt>limit</dt><dd>The maximum number of results that can appear.</dd>
415 <dt>q</dt><dd>The query that was executed.</dd>
24591d9 docs
Robert Newson authored Apr 26, 2009
416 <dt>rows</dt><dd>The search results array, described below.</dd>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
417 <dt>search_duration</dt><dd>The number of milliseconds spent performing the search.</dd>
418 <dt>skip</dt><dd>The number of initial matches that was skipped.</dd>
419 <dt>total_rows</dt><dd>The total number of matches for this query.</dd>
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
420 </dl>
421
24591d9 docs
Robert Newson authored Apr 26, 2009
422 <h2>The search results array</h2>
423
424 The search results arrays consists of zero, one or more objects with the following fields;
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
425
426 <dl>
f420bf7 support different Analyzer's at index and query time.
Robert Newson authored Aug 2, 2009
427 <dt>doc</dt><dd>The original document from couch, if requested with include_docs=true</dd>
428 <dt>fields</dt><dd>All the fields that were stored with this match</dd>
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
429 <dt>id</dt><dd>The unique identifier for this match.</dd>
430 <dt>score</dt><dd>The normalized score (0.0-1.0, inclusive) for this match</dd>
431 </dl>
432
fd16315 update README.md
Robert Newson authored Mar 7, 2009
433 Here's an example of a JSON response without sorting;
b207965 improve README readability.
Robert Newson authored Feb 14, 2009
434
118d28e JSON example output.
Robert Newson authored Feb 17, 2009
435 <pre>
436 {
c6356fd update README.md and TODO to reflect progress.
Robert Newson authored Apr 26, 2009
437 "q": "+content:enron",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
438 "skip": 0,
439 "limit": 2,
440 "total_rows": 176852,
441 "search_duration": 518,
442 "fetch_duration": 4,
443 "rows": [
444 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
445 "id": "hain-m-all_documents-257.",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
446 "score": 1.601625680923462
447 },
448 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
449 "id": "hain-m-notes_inbox-257.",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
450 "score": 1.601625680923462
451 }
118d28e JSON example output.
Robert Newson authored Feb 17, 2009
452 ]
453 }
454 </pre>
455
fd16315 update README.md
Robert Newson authored Mar 7, 2009
456 And the same with sorting;
457
118d28e JSON example output.
Robert Newson authored Feb 17, 2009
458 <pre>
459 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
460 "q": "+content:enron",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
461 "skip": 0,
462 "limit": 3,
463 "total_rows": 176852,
464 "search_duration": 660,
465 "fetch_duration": 4,
466 "sort_order": [
467 {
468 "field": "source",
469 "reverse": false,
470 "type": "string"
471 },
472 {
473 "reverse": false,
474 "type": "doc"
475 }
118d28e JSON example output.
Robert Newson authored Feb 17, 2009
476 ],
fd16315 update README.md
Robert Newson authored Mar 7, 2009
477 "rows": [
478 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
479 "id": "shankman-j-inbox-105.",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
480 "score": 0.6131107211112976,
481 "sort_order": [
482 "enron",
483 6
484 ]
485 },
486 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
487 "id": "shankman-j-inbox-8.",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
488 "score": 0.7492915391921997,
489 "sort_order": [
490 "enron",
491 7
492 ]
493 },
494 {
0fcf578 update docs.
Robert Newson authored Apr 26, 2009
495 "id": "shankman-j-inbox-30.",
fd16315 update README.md
Robert Newson authored Mar 7, 2009
496 "score": 0.507369875907898,
497 "sort_order": [
498 "enron",
499 8
500 ]
501 }
118d28e JSON example output.
Robert Newson authored Feb 17, 2009
502 ]
503 }
504 </pre>
505
a4aa4e1 document Content-Type response negotiation
Robert Newson authored Aug 2, 2009
506 <h3>Content-Type of response</h3>
507
d2e1e9e add notes about typing.
Robert Newson authored Aug 31, 2009
508 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.
a4aa4e1 document Content-Type response negotiation
Robert Newson authored Aug 2, 2009
509
139a78c add info retrieval.
Robert Newson authored Mar 9, 2009
510 <h1>Fetching information about the index</h1>
511
0cf4941 correct info urls.
Robert Newson authored Jan 10, 2010
512 Calling couchdb-lucene without arguments returns a JSON object with information about the index.
139a78c add info retrieval.
Robert Newson authored Mar 9, 2009
513
514 <pre>
6b73dc6 commit to _design/foo in paths, use regexp to be sure.
Robert Newson authored Apr 17, 2010
515 http://127.0.0.1:5984/&lt;db>/_fti/_design/foo/&lt;index
139a78c add info retrieval.
Robert Newson authored Mar 9, 2009
516 </pre>
517
518 returns;
519
520 <pre>
f6ac048 line breaks
Robert Newson authored Jan 10, 2010
521 {"current":true,"disk_size":110674,"doc_count":397,"doc_del_count":0,
522 "fields":["default","number"],"last_modified":"1263066382000",
523 "optimized":true,"ref_count":2}
139a78c add info retrieval.
Robert Newson authored Mar 9, 2009
524 </pre>
8203af6 support _optimize and _expunge calls.
Robert Newson authored Jan 10, 2010
525
526 <h1>Index Maintenance</h1>
527
528 For optimal query speed you can optimize your indexes. This causes the index to be rewritten into a single segment.
529
530 <pre>
6b73dc6 commit to _design/foo in paths, use regexp to be sure.
Robert Newson authored Apr 17, 2010
531 curl -X POST http://localhost:5984/&lt;db>/_fti/_design/foo/&lt;index>/_optimize
8203af6 support _optimize and _expunge calls.
Robert Newson authored Jan 10, 2010
532 </pre>
533
534 If you just want to expunge pending deletes, then call;
535
536 <pre>
6b73dc6 commit to _design/foo in paths, use regexp to be sure.
Robert Newson authored Apr 17, 2010
537 curl -X POST http://localhost:5984/&lt;db>/_fti/_design/foo/&lt;index>/_expunge
8203af6 support _optimize and _expunge calls.
Robert Newson authored Jan 10, 2010
538 </pre>
6e66766 most of index cleanup work
Robert Newson authored Jan 31, 2010
539
540 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;
541
542 <pre>
543 curl -X POST http://localhost:5984/&lt;db>/_fti/_cleanup
544 </pre>
Something went wrong with that request. Please try again.