{"id":13553137,"url":"https://github.com/rnewson/couchdb-lucene","last_synced_at":"2025-10-21T04:04:08.261Z","repository":{"id":488260,"uuid":"114387","full_name":"rnewson/couchdb-lucene","owner":"rnewson","description":"Enables full-text searching of CouchDB documents using Lucene","archived":true,"fork":false,"pushed_at":"2022-03-27T22:51:48.000Z","size":3564,"stargazers_count":771,"open_issues_count":82,"forks_count":146,"subscribers_count":36,"default_branch":"master","last_synced_at":"2025-08-28T13:58:00.036Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnewson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-01-25T15:37:12.000Z","updated_at":"2025-08-13T11:08:28.000Z","dependencies_parsed_at":"2022-07-04T19:31:24.220Z","dependency_job_id":null,"html_url":"https://github.com/rnewson/couchdb-lucene","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/rnewson/couchdb-lucene","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnewson%2Fcouchdb-lucene","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnewson%2Fcouchdb-lucene/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnewson%2Fcouchdb-lucene/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnewson%2Fcouchdb-lucene/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnewson","download_url":"https://codeload.github.com/rnewson/couchdb-lucene/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnewson%2Fcouchdb-lucene/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280200872,"owners_count":26289477,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T12:02:18.180Z","updated_at":"2025-10-21T04:04:07.948Z","avatar_url":"https://github.com/rnewson.png","language":"Java","funding_links":[],"categories":["Java","others","II. Databases, search engines, big data and machine learning"],"sub_categories":["4. Client and drivers for databases"],"readme":"# couchdb-lucene [![Build Status](https://secure.travis-ci.org/rnewson/couchdb-lucene.svg)](http://travis-ci.org/rnewson/couchdb-lucene)\n\n## Version Compatibility\nCouchDB-Lucene works with all version of CouchDB from 0.10 upwards.\n\n## Issue Tracking\nIssue tracking at [github](http://github.com/rnewson/couchdb-lucene/issues).\n\n## Minimum System Requirements\nJava 1.8 is required; Oracle Java 8 or OpenJDK 8 are recommended.\n\n## Build and run couchdb-lucene\nIf you are on OS X, you might find it easiest to:\n\n```bash\nbrew install couchdb-lucene\n```\n\n1. Install Maven (2 or 3).\n2. checkout repository\n3. type 'mvn'\n4. cd target\n5. unzip couchdb-lucene-\\\u003cversion\\\u003e.zip\n6. cd couchdb-lucene-\\\u003cversion\\\u003e\n7. ./bin/run\n\nThe zip file contains all the couchdb-lucene code, dependencies, startup scripts and configuration files you need, so unzip it wherever you wish to install couchdb-lucene.\n\nIf you want to run couchdb-lucene on a servlet container like Tomcat, you can build the war file using Maven\n\n```bash\nmvn war:war\n```\n\n## Configure CouchDB\nThe following settings are needed in CouchDB's local.ini file in order for it to communicate with couchdb-lucene:\n\n### Proxy handler (for CouchDB versions from 1.1 onward)\n```ini\n[httpd_global_handlers]\n_fti = {couch_httpd_proxy, handle_proxy_req, \u003c\u003c\"http://127.0.0.1:5985\"\u003e\u003e}\n```\n\n### Python hook script (for CouchDB versions prior to 1.1)\n```ini\n[couchdb]\nos_process_timeout=60000 ; increase the timeout from 5 seconds.\n\n[external]\nfti=/path/to/python /path/to/couchdb-lucene/tools/couchdb-external-hook.py\n\n[httpd_db_handlers]\n_fti = {couch_httpd_external, handle_external_req, \u003c\u003c\"fti\"\u003e\u003e}\n```\n\n#### Hook options\nYou can pass options to the python script like so:\n```ini\n[external]\nfti=/path/to/python \"/path/to/couchdb-lucene/tools/couchdb-external-hook.py --option-name value\"\n```\n\n|Option       |Meaning                                                                     |Default Value|\n|-------------|----------------------------------------------------------------------------|-------------|\n|--remote-host|The hostname of the couchdb-lucene server                                   |localhost    |\n|--remote-port|The port of the couchdb-lucene server                                       |5985         |\n|--local-key  |The key for the local couchdb instance as known to the couchdb-lucene server|local        |\n\n## Configure couchdb-lucene\ncouchdb-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.\n\n## Start couchdb-lucene\nTo start couchdb-lucene, run:\n```bash\nbin/run\n```\n\nTo stop couchdb-lucene, simply kill the Java process.\n\n## Indexing Strategy\n### Document Indexing\nYou 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.\n\nYou 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.\n\nHere's an complete example of a design document with couchdb-lucene features:\n\n```json\n{\n    \"_id\":\"_design/foo\",\n    \"fulltext\": {\n        \"by_subject\": {\n            \"index\":\"function(doc) { var ret=new Document(); ret.add(doc.subject); return ret }\"\n        },\n        \"by_content\": {\n            \"index\":\"function(doc) { var ret=new Document(); ret.add(doc.content); return ret }\"\n        }\n    }\n}\n```\n\nHere are some example URL's for the given design document:\n\n### Using the Python hook script\n```\nhttp://localhost:5984/database/_fti/_design/foo/by_subject?q=hello\nhttp://localhost:5984/database/_fti/_design/foo/by_content?q=hello\n```\n\n### Using the proxy handler\n```\nhttp://localhost:5984/_fti/local/database/_design/foo/by_subject?q=hello\nhttp://localhost:5984/_fti/local/database/_design/foo/by_content?q=hello\n```\n\nA fulltext object contains multiple index view declarations. An index view consists of:\n\n***analyzer***\n  (optional) The analyzer to use\n\n***defaults***\n  (optional) The default for numerous indexing options can be overridden here. A full list of options follows.\n\n***index***\n  The indexing function itself, documented below.\n\n#### The Defaults Object\nThe following indexing options can be defaulted:\n\n|name|description|available options|default|\n|----|-----------|-----------------|-------|\n|field|the field name to index under|user-defined|default|\n|type|the type of the field|date, double, float, int, long, string, text|text|\n|store|whether the data is stored. The value will be returned in the search result.|yes, no|no|\n|boost|Sets the boost factor hits on this field. This value will be multiplied into the score of all hits on this this field of this document.|floating-point value|1.0|\n\n#### String vs Text\n\nThere are two supported types that sound equivalent, *string* and *text*, but they are very different. A text field will be tokenized into words and is usually what you expect from a full-text index. A string field is not tokenized, only exact matching will work. The advantage to string fields is that they have a meaningful sort order.\n\n#### The Analyzer Option\n\nLucene 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:\n\n- brazilian\n- chinese\n- cjk\n- czech\n- dutch\n- english\n- french\n- german\n- keyword\n- perfield\n- porter\n- russian\n- simple\n- snowball\n- standard\n- thai\n- whitespace\n- ngram\n\n##### The Snowball Analyzer\nThis analyzer requires an extra argument to specify the language (see [here](http://lucene.apache.org/java/3_0_3/api/contrib-snowball/org/apache/lucene/analysis/snowball/SnowballAnalyzer.html) for details):\n\n```json\n\"analyzer\":\"snowball:English\"\n```\n\nNote: the argument is case-sensitive and is passed directly to the `SnowballAnalyzer`'s constructor.\n\n##### The Per-field Analyzer\nThe \"perfield\" option lets you use a different analyzer for different fields and is configured as follows:\n\n```json\n\"analyzer\":\"perfield:{field_name:\\\"analyzer_name\\\"}\"\n```\n\nUnless overridden, any field name not specified will be handled by the standard analyzer. To change the default, use the special default field name:\n\n```json\n\"analyzer\":\"perfield:{default:\\\"keyword\\\"}\"\n```\n\n##### The Ngram Analyzer\nThe \"ngram\" analyzer lets you break down the output of any other analyzer into ngrams (\"foo\" becomes \"fo\" and \"oo\").\n\n```json\n\"analyzer\":\"ngram:{analyzer:\\\"simple\\\",min:2,max:3}\"\n```\n\nIf not specified, the delegated analyzer is \"standard\" and min and max ngram sizes are 1 and 2 respectively.\n\n##### Configuring additional analyzers\n\nThere are many other analyzers included in Lucene and there are also occasions where custom analyzers not included in Lucene are needed. \nThere is now support for [configuring additional analyzers](CONFIGURING_ANALYZERS.md) without needing to further modify couchdb-lucene.\n\n#### The Document class\nYou may construct a new Document instance with:\n\n```js\nvar doc = new Document();\n```\n\nData 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.\n\n```js\n// Add with all the defaults.\ndoc.add(\"value\");\n\n// Add a numeric field.\ndoc.add(35, {\"type\":\"int\"});\n\n// Add a date field.\ndoc.add(new Date(\"1972/1/6 16:05:00\"),        {\"type\":\"date\"});\ndoc.add(new Date(\"January 6, 1972 16:05:00\"), {\"type\":\"date\"});\n\n// Add a date field (object must be a Date object\n\n// Add a subject field.\ndoc.add(\"this is the subject line.\", {\"field\":\"subject\"});\n\n// Add but ensure it's stored.\ndoc.add(\"value\", {\"store\":\"yes\"});\n\n// Add but don't analyze.\ndoc.add(\"don't analyze me\", {\"index\":\"not_analyzed\"});\n\n// Extract text from the named attachment and index it to a named field\ndoc.attachment(\"attachment field\", \"attachment name\");\n\n// log an event (trace, debug, info, warn and error are available)\nif (doc.foo) {\n  log.info(\"doc has foo property!\");\n}\n```\n\n#### Example Index Functions\n##### Index Everything\n```js\nfunction(doc) {\n    var ret = new Document();\n\n    function idx(obj) {\n\tfor (var key in obj) {\n\t    switch (typeof obj[key]) {\n\t    case 'object':\n\t\tidx(obj[key]);\n\t\tbreak;\n\t    case 'function':\n\t\tbreak;\n\t    default:\n\t\tret.add(obj[key]);\n\t\tbreak;\n\t    }\n\t}\n    };\n\n    idx(doc);\n\n    if (doc._attachments) {\n\tfor (var i in doc._attachments) {\n\t    ret.attachment(\"default\", i);\n\t}\n    }\n\n    return ret;\n}\n```\n\n##### Index Nothing\n```js\nfunction(doc) {\n  return null;\n}\n```\n\n##### Index Select Fields\n```js\nfunction(doc) {\n  var result = new Document();\n  result.add(doc.subject, {\"field\":\"subject\", \"store\":\"yes\"});\n  result.add(doc.content, {\"field\":\"subject\"});\n  result.add(new Date(), {\"field\":\"indexed_at\"});\n  return result;\n}\n```\n\n##### Index Attachments\n```js\nfunction(doc) {\n  var result = new Document();\n  for(var a in doc._attachments) {\n    result.attachment(\"default\", a);\n  }\n  return result;\n}\n```\n\n##### A More Complex Example\n```js\nfunction(doc) {\n    var mk = function(name, value, group) {\n        var ret = new Document();\n        ret.add(value, {\"field\": group, \"store\":\"yes\"});\n        ret.add(group, {\"field\":\"group\", \"store\":\"yes\"});\n        return ret;\n    };\n    if(doc.type != \"reference\") return null;\n    var ret = new Array();\n    for(var g in doc.groups) {\n        ret.push(mk(\"library\", doc.groups[g].library, g));\n        ret.push(mk(\"method\", doc.groups[g].method, g));\n        ret.push(mk(\"target\", doc.groups[g].target, g));\n    }\n    return ret;\n}\n```\n\n### Attachment Indexing\nCouchdb-lucene uses [Apache Tika](http://lucene.apache.org/tika/) to index attachments of the following types, assuming the correct content_type is set in couchdb;\n\n#### Supported Formats\n- Excel spreadsheets (application/vnd.ms-excel)\n- HTML (text/html)\n- Images (image/*)\n- Java class files\n- Java jar archives\n- MP3 (audio/mp3)\n- OpenDocument (application/vnd.oasis.opendocument.*)\n- Outlook (application/vnd.ms-outlook)\n- PDF (application/pdf)\n- Plain text (text/plain)\n- Powerpoint presentations (application/vnd.ms-powerpoint)\n- RTF (application/rtf)\n- Visio (application/vnd.visio)\n- Word documents (application/msword)\n- XML (application/xml)\n\n## Searching with couchdb-lucene\nYou can perform all types of queries using Lucene's default [query syntax](http://lucene.apache.org/java/3_6_2/queryparsersyntax.html).\n\n### Numeric range queries\nIn addition to normal text-based range searches (using the \"field:[lower TO upper]\" syntax), couchdb-lucene also supports numeric range searches for the following types: int, long, float, double and date. The type is specified after the field name, as follows:\n\n|type|example|\n|----|-------|\n|int|field\u003cint\u003e:[0 TO 100]|\n|long|field\u003clong\u003e:[0 TO 100]|\n|float|field\u003cfloat\u003e:[0.0 TO 100.0]|\n|double|field\u003cdouble\u003e:[0.0 TO 100.0]|\n|date|field\u003cdate\u003e:[from TO to] where from and to match any of these patterns: `\"yyyy-MM-dd'T'HH:mm:ssZ\"`, `\"yyyy-MM-dd'T'HH:mm:ss\"`, `\"yyyy-MM-ddZ\"`, `\"yyyy-MM-dd\"`, `\"yyyy-MM-dd'T'HH:mm:ss.SSSZ\"`, `\"yyyy-MM-dd'T'HH:mm:ss.SSS\"`. So, in order to search for articles published in July, you would issue a following query: `published_at\u003cdate\u003e:[\"2010-07-01T00:00:00\"+TO+\"2010-07-31T23:59:59\"]`|\n\nAn example numeric range query for spatial searching.\n\n```\n?q=pizza AND lat\u003cdouble\u003e:[51.4707 TO 51.5224] AND long\u003cdouble\u003e:[-0.6622 TO -0.5775]\n```\n\n### Numeric term queries\nFields indexed with numeric types can still be queried as normal terms, couchdb-lucene just needs to know the type. For example, `?q=age\u003clong\u003e:12` will find all documents where the field called 'age' has a value of 12 (when the field was indexed as \"type\":\"int\".\n\n### Search methods\nYou may use HTTP GET or POST. For POST, use application/x-www-form-urlencoded format.\n\n### Search parameters\nThe following parameters can be passed for more sophisticated searches:\n\n***analyzer***\n  Override the default analyzer used to parse the q parameter\n\n***callback***\n  Specify a JSONP callback wrapper. The full JSON result will be prepended with this parameter and also placed with parentheses.\"\n\n***debug***\n  Setting this to true disables response caching (the query is executed every time) and indents the JSON response for readability.\n\n***default_operator***\n  Change the default operator for boolean queries. Defaults to \"OR\", other permitted value is \"AND\".\n\n***force_json***\n  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.\n\n***include_docs***\n  whether to include the source docs\n\n***include_fields***\n  By default, *all* stored fields are returned with results. Use a comma-separate list of field names with this parameter to refine the response\n\n***highlights***\n  Number of highlights to include with results. Default is *0*. This uses the *fast-vector-highlighter* plugin.\n\n***highlight_length***\n  Number of characters to include in a highlight row. Default and minimum is *18*.\n\n***limit***\n  the maximum number of results to return. Default is *25*.\n\n***q***\n  the query to run (e.g, subject:hello). If not specified, the default field is searched. Multiple queries can be supplied, separated by commas; the resulting JSON will be an array of responses.\n\n***skip***\n  the number of results to skip\n\n***sort***\n  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\u003cfloat\u003e). Supported types are 'float', 'double', 'int', 'long' and 'date'.\n\n***stale=ok***\n  If you set the *stale* option to *ok*, couchdb-lucene will not block if the index is not up to date and it will immediately return results. Therefore searches may be faster as Lucene caches important data (especially for sorting). A query without stale=ok will block and use the latest data committed to the index. Unlike CouchDBs stale=ok option for views, couchdb-lucene will trigger an index update unless one is already running.\n\n*All parameters except 'q' are optional.*\n\n### Special Fields\n***_id***\n  The _id of the document.\n\n### Dublin Core\nAll Dublin Core attributes are indexed and stored if detected in the attachment. Descriptions of the fields come from the Tika javadocs.\n\n\n***_dc.contributor***\n   An entity responsible for making contributions to the content of the resource.\n\n***_dc.coverage***\n  The extent or scope of the content of the resource.\n\n***_dc.creator***\n  An entity primarily responsible for making the content of the resource.\n\n***_dc.date***\n  A date associated with an event in the life cycle of the resource.\n\n***_dc.description***\n  An account of the content of the resource.\n\n***_dc.format***\n  Typically, Format may include the media-type or dimensions of the resource.\n\n***_dc.identifier***\n  Recommended best practice is to identify the resource by means of a string or number conforming to a formal identification system.\n\n***_dc.language***\n  A language of the intellectual content of the resource.\n\n***_dc.modified***\n  Date on which the resource was changed.\n\n***_dc.publisher***\n  An entity responsible for making the resource available.\n\n***_dc.relation***\n  A reference to a related resource.\n\n***_dc.rights***\n  Information about rights held in and over the resource.\n\n***_dc.source***\n  A reference to a resource from which the present resource is derived.\n\n***_dc.subject***\n  The topic of the content of the resource.\n\n***_dc.title***\n  A name given to the resource.\n\n***_dc.type***\n  The nature or genre of the content of the resource.\n\n### Examples\n\n### Using the Python hook script\n```\nhttp://localhost:5984/dbname/_fti/_design/foo/view_name?q=field_name:value\nhttp://localhost:5984/dbname/_fti/_design/foo/view_name?q=field_name:value\u0026sort=other_field\nhttp://localhost:5984/dbname/_fti/_design/foo/view_name?debug=true\u0026sort=billing_size\u003clong\u003e\u0026q=body:document AND customer:[A TO C]\n```\n\n### Using the proxy handler\n```\nhttp://localhost:5984/_fti/local/dbname/_design/foo/view_name?q=field_name:value\nhttp://localhost:5984/_fti/local/dbname/_design/foo/view_name?q=field_name:value\u0026sort=other_field\nhttp://localhost:5984/_fti/local/dbname/_design/foo/view_name?debug=true\u0026sort=billing_size\u003clong\u003e\u0026q=body:document AND customer:[A TO C]\n```\n\n### Search Results Format\nThe search result contains a number of fields at the top level, in addition to your search results.\n\n***etag***\n  An opaque token that reflects the current version of the index. This value is also returned in an ETag header to facilitate HTTP caching.\n\n***fetch_duration***\n  The number of milliseconds spent retrieving the documents.\n\n***limit***\n  The maximum number of results that can appear.\n\n***q***\n  The query that was executed.\n\n***rows***\n  The search results array, described below.\n\n***search_duration***\n  The number of milliseconds spent performing the search.\n\n***skip***\n  The number of initial matches that was skipped.\n\n***total_rows***\n  The total number of matches for this query.\n\n### The search results array\n\nThe search results arrays consists of zero, one or more objects with the following fields:\n\n***doc***\n  The original document from couch, if requested with include_docs=true\n\n***fields***\n  All the fields that were stored with this match\n\n***id***\n  The unique identifier for this match.\n\n***score***\n  The normalized score (0.0-1.0, inclusive) for this match\n\nHere's an example of a JSON response without sorting:\n\n```json\n{\n  \"q\": \"+content:enron\",\n  \"skip\": 0,\n  \"limit\": 2,\n  \"total_rows\": 176852,\n  \"search_duration\": 518,\n  \"fetch_duration\": 4,\n  \"rows\":   [\n        {\n      \"id\": \"hain-m-all_documents-257.\",\n      \"score\": 1.601625680923462\n    },\n        {\n      \"id\": \"hain-m-notes_inbox-257.\",\n      \"score\": 1.601625680923462\n    }\n  ]\n}\n```\n\nAnd the same with sorting:\n\n```json\n{\n  \"q\": \"+content:enron\",\n  \"skip\": 0,\n  \"limit\": 3,\n  \"total_rows\": 176852,\n  \"search_duration\": 660,\n  \"fetch_duration\": 4,\n  \"sort_order\":   [\n        {\n      \"field\": \"source\",\n      \"reverse\": false,\n      \"type\": \"string\"\n    },\n        {\n      \"reverse\": false,\n      \"type\": \"doc\"\n    }\n  ],\n  \"rows\":   [\n        {\n      \"id\": \"shankman-j-inbox-105.\",\n      \"score\": 0.6131107211112976,\n      \"sort_order\":       [\n        \"enron\",\n        6\n      ]\n    },\n        {\n      \"id\": \"shankman-j-inbox-8.\",\n      \"score\": 0.7492915391921997,\n      \"sort_order\":       [\n        \"enron\",\n        7\n      ]\n    },\n        {\n      \"id\": \"shankman-j-inbox-30.\",\n      \"score\": 0.507369875907898,\n      \"sort_order\":       [\n        \"enron\",\n        8\n      ]\n    }\n  ]\n}\n```\n\n#### Content-Type of response\nThe 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.\n\n## Fetching information about the index\nCalling couchdb-lucene without arguments returns a JSON object with information about the index.\n\n```\nhttp://127.0.0.1:5984/\u003cdb\u003e/_fti/_design/foo/\u003cindex\u003e\n```\n\nreturns:\n\n```json\n{\"current\":true,\"disk_size\":110674,\"doc_count\":397,\"doc_del_count\":0,\n\"fields\":[\"default\",\"number\"],\"last_modified\":\"1263066382000\",\n\"optimized\":true,\"ref_count\":2}\n```\n\n## Index Maintenance\nFor optimal query speed you can optimize your indexes. This causes the index to be rewritten into a single segment.\n\n```bash\ncurl -X POST http://localhost:5984/\u003cdb\u003e/_fti/_design/foo/\u003cindex\u003e/_optimize\n```\n\nIf you just want to expunge pending deletes, then call:\n\n```bash\ncurl -X POST http://localhost:5984/\u003cdb\u003e/_fti/_design/foo/\u003cindex\u003e/_expunge\n```\n\nIf 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:\n\n```bash\ncurl -X POST http://localhost:5984/\u003cdb\u003e/_fti/_cleanup\n```\n\n## Authentication\n\nBy default couchdb-lucene does not attempt to authenticate to CouchDB. If you have set CouchDB's require_valid_user to true, you will need to modify couchdb-lucene.ini. Change the url setting to include a valid username and password. e.g, the default setting is:\n\n```ini\n[local]\nurl=http://localhost:5984/\n```\n\nChange it to:\n\n```ini\n[local]\nurl=http://foo:bar@localhost:5984/\n```\n\nand couchdb-lucene will authenticate to couchdb.\n\n## Other Tricks\nA couple of 'expert' options can be set in the couchdb-lucene.ini file;\n\nLeading wildcards are prohibited by default as they perform very poorly most of the time. You can enable them as follows:\n\n```ini\n[lucene]\nallowLeadingWildcard=true\n```\n\nLucene automatically converts terms to lower case in wildcard situations. You can disable this with:\n\n```ini\n[lucene]\nlowercaseExpandedTerms=false\n```\n\nCouchDB-Lucene will keep your indexes up to date automatically but this consumes resources (network sockets). You can ask CouchDB-Lucene to stop updating an index after a timeout with:\n\n```ini\n[lucene]\nchanges_timeout = 60000\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnewson%2Fcouchdb-lucene","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnewson%2Fcouchdb-lucene","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnewson%2Fcouchdb-lucene/lists"}