def startSearch( self, text ): """rebuilds query based on filtering text""" assert object_thread( self ) from camelot.view.search import create_entity_search_query_decorator logger.debug( 'search %s' % text ) self.search_filter = create_entity_search_query_decorator( self.admin, unicode(text) ) self.rebuild_query()
def startSearch(self, text): """rebuilds query based on filtering text""" from camelot.view.search import create_entity_search_query_decorator logger.debug('search %s' % text) self.search_filter = create_entity_search_query_decorator( self.admin, unicode(text)) self.rebuild_query()
def startSearch(self, text): """rebuilds query based on filtering text""" assert object_thread(self) from camelot.view.search import create_entity_search_query_decorator logger.debug('search %s' % text) self.search_filter = create_entity_search_query_decorator( self.admin, six.text_type(text)) self.rebuild_query()
def search_completions(self, text): """Search for object that match text, to fill the list of completions :return: a list of tuples of (dict_of_object_representation, object) """ search_decorator = create_entity_search_query_decorator( self.admin, text) if search_decorator: sresult = [ self.admin.get_search_identifiers(e) for e in search_decorator(self.admin.get_query()).limit(20) ] return text, sresult return text, []
def search_completions(self, text): """Search for object that match text, to fill the list of completions :return: a list of tuples of (object_representation, object_getter) """ search_decorator = create_entity_search_query_decorator( self.admin, text) if search_decorator: sresult = [ (unicode(e), create_constant_function(e)) for e in search_decorator(self.admin.entity.query).limit(20) ] return text, sresult return text, []
def search_completions(self, text): """Search for object that match text, to fill the list of completions :return: a list of tuples of (object_representation, object_getter) """ search_decorator = create_entity_search_query_decorator( self.admin, text ) if search_decorator: sresult = [ (unicode(e), create_constant_function(e)) for e in search_decorator(self.admin.entity.query).limit(20) ] return text, sresult return text, []
def test_search_decorator( self ): """Verify it search works for most common types""" from camelot.view.search import create_entity_search_query_decorator for (i,name), definition in types_to_test.items(): value = self.value_for_type( definition, i ) # # @todo : search for types that need special conversion to string # is skipped for now because the test would become too # convoluted, this should work through a to_string field # attribute. # if isinstance( value, ( datetime.date, datetime.time, bool) ): continue string_value = str( value ) search_decorator = create_entity_search_query_decorator( self.admin, string_value ) query = self.session.query( T ) query = search_decorator( query ) #print query self.assertTrue( query.count() > 0 )