'Initializer.
For example, the following code fragment requests a search for
documents where \'first\' occurs in subject and \'good\' occurs anywhere,
returning at most 20 documents, starting the search from \'cursor token\',
returning another single cursor for the SearchResults, sorting by subject in
descending order, returning the author, subject, and summary fields as well
as a snippeted field content.
results = index.search(Query(
query=\'subject:first good\',
options=QueryOptions(
limit=20,
cursor=Cursor(),
sort_options=SortOptions(
expressions=[
SortExpression(expression=\'subject\')],
limit=1000),
returned_fields=[\'author\', \'subject\', \'summary\'],
snippeted_fields=[\'content\'])))
Args:
limit: The limit on number of documents to return in results.
number_found_accuracy: The minimum accuracy requirement for
SearchResults.number_found. If set, the number_found will be
accurate up to at least that number. For example, when set to 100,
any SearchResults with number_found <= 100 is accurate. This option
may add considerable latency/expense, especially when used with
returned_fields.
cursor: A Cursor describing where to get the next set of results,
or to provide next cursors in SearchResults.
offset: The offset is number of documents to skip in search results. This
is an alternative to using a query cursor, but allows random access into
the results. Using offsets rather than cursors are more expensive. You
can only use either cursor or offset, but not both. Using an offset
means that no cursor is returned in SearchResults.cursor, nor in each
ScoredDocument.cursor.
sort_options: A SortOptions specifying a multi-dimensional sort over
search results.
returned_fields: An iterable of names of fields to return in search
results.
ids_only: Only return document ids, do not return any fields.
snippeted_fields: An iterable of names of fields to snippet and return
in search result expressions.
returned_expressions: An iterable of FieldExpression to evaluate and
return in search results.
Raises:
TypeError: If an unknown iterator_options or sort_options is passed.
ValueError: If ids_only and returned_fields are used together.
ExpressionError: If one of the returned expression strings is not
parseable.'

def __init__(self, limit=20, number_found_accuracy=None, cursor=None, offset=None, sort_options=None, returned_fields=None, ids_only=False, snippeted_fields=None, returned_expressions=None):

    self._limit = _CheckLimit(limit)
    self._number_found_accuracy = _CheckNumberFoundAccuracy(number_found_accuracy)
    if ((cursor is not None) and (not isinstance(cursor, Cursor))):
        raise TypeError(('cursor    must    be    a    Cursor,    got    %s' % cursor.__class__.__name__))
    if ((cursor is not None) and (offset is not None)):
        raise ValueError('cannot    set    cursor    and    offset    together')
    self._cursor = cursor
    self._offset = _CheckOffset(offset)
    if ((sort_options is not None) and (not isinstance(sort_options, SortOptions))):
        raise TypeError(('sort_options    must    be    a    SortOptions,    got    %s' % sort_options.__class__.__name__))
    self._sort_options = sort_options
    self._returned_fields = _ConvertToUnicodeList(returned_fields)
    _CheckFieldNames(self._returned_fields)
    self._ids_only = ids_only
    if (self._ids_only and self._returned_fields):
        raise ValueError('cannot    have    ids_only    and    returned_fields    set    together')
    self._snippeted_fields = _ConvertToUnicodeList(snippeted_fields)
    _CheckFieldNames(self._snippeted_fields)
    self._returned_expressions = _ConvertToList(returned_expressions)
    for expression in self._returned_expressions:
        _CheckFieldName(_ConvertToUnicode(expression.name))
        _CheckExpression(_ConvertToUnicode(expression.expression))
    _CheckNumberOfFields(self._returned_expressions, self._snippeted_fields, self._returned_fields)
