def search(self, query, **kwargs):
response = self._new_response()<EOL>if self._check_supported_op('<STR_LIT>', response):<EOL><INDENT>if '<STR_LIT:=>' not in query:<EOL><INDENT>response.status = '<STR_LIT:error>'<EOL>response.error_type = '<STR_LIT>'<EOL>msg = '<STR_LIT>'<EOL>response.error_message = msg<EOL><DEDENT>else:<EOL><INDENT>key, value = query.split('<STR_LIT:=>')<EOL>if key not in self._indexes:<EOL><INDENT>response.status = '<STR_LIT:error>'<EOL>response.error_type = '<STR_LIT>'<EOL>msg = '<STR_LIT>'.format(key)<EOL>response.error_message = msg<EOL><DEDENT>else:<EOL><INDENT>params = {'<STR_LIT>': Key(key).eq(value)}<EOL>index_name = self._indexes[key]<EOL>if index_name:<EOL><INDENT>params['<STR_LIT>'] = index_name<EOL><DEDENT>pe = kwargs.get('<STR_LIT>')<EOL>if pe:<EOL><INDENT>params['<STR_LIT>'] = pe<EOL><DEDENT>self._call_ddb_method(self.table.query,<EOL>params, response)<EOL>if response.status == '<STR_LIT:success>':<EOL><INDENT>response.data = self._replace_decimals(<EOL>response.raw_response['<STR_LIT>'])<EOL><DEDENT><DEDENT><DEDENT><DEDENT>response.prepare()<EOL>return response<EOL>
Cruddy provides a limited but useful interface to search GSI indexes in
DynamoDB with the following limitations (hopefully some of these will
be expanded or eliminated in the future.

* The GSI must be configured with a only HASH and not a RANGE.
* The only operation supported in the query is equality

To use the ``search`` operation you must pass in a query string of this
form:

    <attribute_name>=<value>

As stated above, the only operation currently supported is equality (=)
but other operations will be added over time.  Also, the
``attribute_name`` must be an attribute which is configured as the
``HASH`` of a GSI in the DynamoDB table.  If all of the above
conditions are met, the ``query`` operation will return a list
(possibly empty) of all items matching the query and the ``status`` of
the response will be ``success``.  Otherwise, the ``status`` will be
``error`` and the ``error_type`` and ``error_message`` will provide
further information about the error.