server

Restful json CherryPy server.

$ python server.py directory [-r|–read-only] [-c|–config filename]
CherryPy and Lucene VM integration issues:
  • Autoreload is not compatible with the VM initialization.
  • WorkerThreads must be attached to the VM.
  • Also recommended that the VM ignores keyboard interrupts for clean server shutdown.

WebSearcher

class server.WebSearcher(*args, **kwargs)

Dispatch root with a delegated IndexSearcher.

docs(id=None, fields='', multifields='')

Return ids or documents.

GET /docs

Return list of doc ids.

return:[int,... ]
GET /docs/int?

Return document mappings, optionally selected unique or multi-valued fields.

&fields=chars,...

&multifields=chars,...

return:{string: string|array,... }
index()

Return index information.

GET /

Return a mapping of the directory to the document count.

return:{string: int}
search(q=None, count=None, fields='', multifields='', sort=None, reverse='false')

Run query and return documents.

GET /search?

Return list of document objects and total doc count.

&q=chars

&count=int

&fields=chars,...

&multifields=chars,...

&sort=chars,...

&reverse=true|false,

return:{“count”: int, “docs”: [{“__id__”: int, “__score__”: number, string: string|array,... },... ]}
terms(name='', value=':', *args, **options)

Return data about indexed terms.

GET /terms?

Return field names, with optional selection.

&option=chars

return:[string,... ]
GET /terms/chars

Return term values for given field name.

return:[string,... ]
GET /terms/chars/chars:chars

Return slice of term values for given field name.

return:[string,... ]
GET /terms/chars/chars

Return document count with given term.

return:int
GET /terms/chars/chars/docs

Return document ids with given term.

return:[int,... ]
GET /terms/chars/chars/docs/counts

Return document ids and frequency counts for given term.

return:[[int, int],... ]
GET /terms/chars/chars/docs/positions

Return document ids and positions for given term.

return:[[int, [int,... ]],... ]

WebIndexer

class server.WebIndexer(*args, **kwargs)

Bases: server.WebSearcher

Dispatch root which extends searcher to include write methods.

commit()

Commit write operations.

POST /commit

docs(id=None, fields='', multifields='', docs='[], ')

Add or return documents.

POST /docs

Add documents to index.

docs=[{string: string|array,... },... ]

fields(name='', **params)

Return or store a field’s parameters.

GET /fields

Return known field names.

return:[string,... ]
GET, PUT, POST /fields/chars

Set and return parameters for given field name.

store=chars

index=chars

termvector=chars

return:{“store”: string, “index”: string, “termvector”: string}
search(q=None, count=None, fields='', multifields='', sort=None, reverse='false')

Run or delete a query.

DELETE /search?q=chars
Delete documents which match query.
server.main(root, path='', config=None)
Attach root and run server.

Table Of Contents

Previous topic

engine

Next topic

client

This Page