Usage: python -m lupyne.server [index_directory ...]
-h, --help | show this help message and exit |
-r, --read-only | |
expose only read methods; no write lock | |
-c CONFIG, --config=CONFIG | |
optional configuration file or json object of global params | |
-p FILE, --pidfile=FILE | |
store the process id in the given file | |
-d, --daemonize | |
run the server as a daemon | |
--autoreload=SECONDS | |
automatically reload modules; replacement for engine.autoreload | |
--autoupdate=SECONDS | |
automatically update index version |
Restful json CherryPy server.
The server script mounts a WebSearcher (read_only) or WebIndexer root. Standard CherryPy configuration applies, and the provided custom tools are also configurable. All request and response bodies are application/json values.
WebSearcher exposes resources for an IndexSearcher. In addition to search requests, it provides access to term and document information in the index. Note Lucene doc ids are ephemeral; they should only be used across requests for the same index version.
WebIndexer extends WebSearcher, exposing additional resources and methods for an Indexer. Single documents may be added, deleted, or replaced by a unique indexed field. Multiples documents may also be added or deleted by query at once. By default changes are not visible until the update resource is called to commit a new index version. If a near real-time Indexer is used (an experimental feature in Lucene), then changes are instantly searchable. In such cases a commit still hasn’t occurred; the index based validation headers shouldn’t be used for caching.
Custom servers should create and mount WebSearchers and WebIndexers as needed. Caches and field settings can then be applied directly before starting the server. WebSearchers and WebIndexers can of course also be subclassed for custom interfaces.
CherryPy tools enabled by default: tools.{json,allow,time,validate}.on
Handle request bodies and responses in json format.
Parameters: |
|
---|
Return and validate caching headers for GET requests.
Parameters: |
|
---|
Dispatch root with a delegated Searcher.
Return ids or documents.
Return array of doc ids.
return: | [int,... ] |
---|
Return document mapping from id or unique name and value. Optionally select stored, multi-valued, and cached indexed fields.
&fields=chars,... &fields.multi=chars,... &fields.indexed=chars[:chars],...
return: | {string: string|number|array,... } |
---|
Return index information.
Return a mapping of the directory to the document count.
return: | {string: int,... } |
---|
Run query and return documents.
Return array of document objects and total doc count.
return: | {
“query”: string,
“count”: int|null,
“maxscore”: number|null,
“docs”: [{“__id__”: int, “__score__”: number, “__highlights__”: {string: array,... }, string: object,... },... ],
“facets”: {string: {string: int,... },... },
“groups”: [{“count”: int, “value”: value, “docs”: [object,... ]},... ]
“spellcheck”: {string: {string: [string,... ],... },... },
}
|
---|
Return data about indexed terms.
Return field names, with optional selection.
&option=chars
return: | [string,... ] |
---|
Return term values for given field name, with optional type and step for numeric encoded values.
return: | [string,... ] |
---|
Return term values (wildcards, slices, or fuzzy terms) for given field name.
return: | [string,... ] |
---|
Return spellchecked term values ordered by decreasing document frequency. Prefixes (*) are optimized to be suitable for real-time query suggestions; all terms are cached.
return: | [string,... ] |
---|
Return document count for given term.
return: | int |
---|
Return document ids for given term.
return: | [int,... ] |
---|
Return document ids and frequency counts for given term.
return: | [[int, int],... ] |
---|
Return document ids and positions for given term.
return: | [[int, [int,... ]],... ] |
---|
Bases: lupyne.server.WebSearcher
Dispatch root with a delegated Indexer, exposing write methods.
Add or return documents. See WebSearcher.docs() for GET method.
Add documents to index.
[{string: string|number|array,... },... ]
Set or delete document. Unique term should be indexed and is added to the new document.
{string: string|number|array,... }
Return or store a field’s parameters.
Return known field names.
return: | [string,... ] |
---|
Set and return parameters for given field name.
{“store”|”index”|”termvector”: string|true|false,... }
return: | {“store”: string, “index”: string, “termvector”: string} |
---|
Add indexes. See WebSearcher.index() for GET method.
Add indexes without optimization.
[string,... ]
Run or delete a query. See WebSearcher.search() for GET method.
Commit index changes and refresh index version.
Commit write operations and return document count. See WebSearcher.update() for caching options.
[“expunge”|”optimize”,... ]
return: | int |
---|
Snapshot current index commit and return array of referenced filenames, or release previous snapshot.
return: | [string,... ] |
---|
Attach root and subscribe to plugins.
Parameters: |
|
---|
Attach root, subscribe to plugins, and start server.
Parameters: |
|
---|