#NEWLINE# def search( self , query , facets = None , facets_limit = None , global_facets = True , suggest_fields = None , suggest_limit = None , fuzziness = None ) : #NEWLINE# #INDENT# '\n        Returns a EsQueryset instance that acts a bit like a django Queryset\n        facets is dictionnary containing facets informations\n        If global_facets is True,\n        the most used facets accross all documents will be returned.\n        if set to False, the facets will be filtered by the search query\n\n        :arg query\n        :arg facets\n        :arg facets_limit\n        :arg global_facets\n        :arg suggest_fields\n        :arg suggest_limit\n        :arg fuzziness\n        ' #NEWLINE# q = self . queryset #NEWLINE# q . fuzziness = fuzziness #NEWLINE# if ( ( facets is None ) and self . model . Elasticsearch . facets_fields ) : #NEWLINE# #INDENT# facets = self . model . Elasticsearch . facets_fields #NEWLINE# #UNINDENT# if facets : #NEWLINE# #INDENT# q = q . facet ( q , limit = ( facets_limit or self . model . Elasticsearch . facets_limit ) , use_globals = global_facets ) #NEWLINE# #UNINDENT# if ( ( suggest_fields is None ) and self . model . Elasticsearch . suggest_fields ) : #NEWLINE# #INDENT# suggest_fields = self . model . Elasticsearch . suggest_fields #NEWLINE# #UNINDENT# if suggest_fields : #NEWLINE# #INDENT# q = q . suggest ( fields = suggest_fields , limit = suggest_limit ) #NEWLINE# #UNINDENT# return q . query ( query )