def rpc_post_index(self, index, yql_query, tag, fn=None, desc=''): """ Creates an index in the backend. In other words search string to query association. Ex: the search string could be 'cute cats' with the yql query. 'select * from search.images where query="cute cats" and mimetype like "%jpeg%"' @argument index The string user would search with. ex: 'cute cats' @argument yql_query The query string. Like the one above. @argument tag The tag you might want to associate with the string. Ex: '/animals/cats'. @argument desc Any details you might want to add (not used anywhere) @returns id Essentially of no use, till now. @note One more parameter might be added to this. """ y = IndexedYQL.create(index, yql_query, tag, fn, desc) if not y: return { 'status': 'error', 'message': 'the index already exists' } return {'id': str(y.key().id())}
def rpc_get_index(self, index): """ Returns the result for the search string. In the backend, the yql query is executed and result formater and returned. @argument index The search string. @result The result of yql search. """ res = IndexedYQL.get_index_result(index) if not res: return {} return res