Permalink
Browse files

Updating the API docs

  • Loading branch information...
1 parent 202bf1a commit 9868c1fecb5628f36e4f72fe351c055f8f621082 @coleifer committed Jul 3, 2012
Showing with 12 additions and 6 deletions.
  1. +12 −6 docs/api.rst
View
@@ -30,13 +30,14 @@ API
from redis_completion import RedisEngine
engine = RedisEngine()
- .. py:method:: store(obj_id[, title=None[, data=None]])
+ .. py:method:: store(obj_id[, title=None[, data=None[, obj_type=None]]])
:param obj_id: a unique identifier for the object
:param title: a string to store in the index and allow autocompletion on,
which, if not provided defaults to the given ``obj_id``
:param data: any data you wish to store and return when a given title is
searched for. If not provided, defaults to the given ``title`` (or ``obj_id``)
+ :param obj_type: an additional identifier for this object if multiple types are stored
Store an object in the index and allow it to be searched for.
@@ -61,25 +62,27 @@ API
'url': entry.url,
})
- .. py:method:: store_json(obj_id, title, data)
+ .. py:method:: store_json(obj_id, title, data[, obj_type=None])
Like :py:meth:`store` except ``data`` is automatically serialized as JSON
before being stored in the index. Best when used in conjunction with
:py:meth:`search_json`.
- .. py:method:: exists(obj_id)
+ .. py:method:: exists(obj_id[, obj_type=None])
:param obj_id: a unique identifier for the object
+ :param obj_type: an additional identifier for this object if multiple types are stored
Checks if the given object exists in the index
- .. py:method:: remove(obj_id)
+ .. py:method:: remove(obj_id[, obj_type=None])
:param obj_id: a unique identifier for the object
+ :param obj_type: an additional identifier for this object if multiple types are stored
Removes the given object from the index.
- .. py:method:: search(phrase[, limit=None[, filters=None[, mappers=None]]])
+ .. py:method:: search(phrase[, limit=None[, filters=None[, mappers=None[, boosts=None]]]])
:param phrase: search the index for the given phrase
:param limit: an integer indicating the number of results to limit the
@@ -91,6 +94,9 @@ API
will prevent a result from being returned.
:param mappers: a list of callables which will be used to transform the
raw data returned from the index.
+ :param dict boosts: a mapping of type identifier -> float value -- if provided,
+ results of a given type will have their scores multiplied by the corresponding
+ float value
:rtype: A list containing data returned by the index
.. note:: Mappers act upon data before it is passed to the filters
@@ -104,7 +110,7 @@ API
[{'published': True, 'title': 'an entry about python', 'url': '/blog/1/'},
{'published': False, 'title': 'using redis with python', 'url': '/blog/3/'}]
- .. py:method:: search_json(phrase[, limit=None[, filters=None[, mappers=None]]])
+ .. py:method:: search_json(phrase[, limit=None[, filters=None[, mappers=None[, boosts=None]]]])
Like :py:meth:`search` except ``json.loads`` is inserted as the very first
mapper. Best when used in conjunction with :py:meth:`store_json`.

0 comments on commit 9868c1f

Please sign in to comment.