server

Restful json CherryPy server.

$ python server.py directory
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.

Root

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

Dispatch root with a delegated Indexer.

commit()

Commit write operations.

POST /commit

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

Return and index 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,... }
POST /docs

Add documents to index.

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

fields(name='', **params)

Return and store a field’s parameters.

GET /fields

Return known field names.

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

Return parameters for given field name.

return:{“store”: string, “index”: string, “termvector”: string}
PUT /fields/chars

Set parameters for given field name.

store=chars

index=chars

termvector=chars

index()

Return index information.

GET /

Return a mapping of the directory to the document count.

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

Run or delete a query.

DELETE /search?q=chars
Delete documents which match query.
GET /search?q=chars,

Return list document mappings and total doc count.

&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,... ]],... ]
server.main(root, path='', config=None)
Attach root and run server.

Table Of Contents

Previous topic

engine

Next topic

client

This Page