return index, speller
-def lookup(name, session=None, exact_only=False):
+def lookup(name, session=None, indices=None, exact_only=False):
"""Attempts to find some sort of object, given a database session and name.
Returns (objects, exact) where `objects` is a list of database objects, and
if this is not provided, a connection to the default database will be
attempted.
+ `indices`
+ Tuple of index, speller as returned from `open_index()`. Defaults to
+ a call to `open_index()`.
+
`exact_only`
If True, only exact matches are returned. If set to False (the
default), and the provided `name` doesn't match anything exactly,
if not session:
session = connect()
- index, speller = open_index()
+ if indices:
+ index, speller = indices
+ else:
+ index, speller = open_index()
exact = True