def test_search(self): instance = self._create_test_data() search.index_entity(instance, index="test_index") error, results, current_cursor, next_cursor = search.search("test_index", "") assert not error assert len(results) == 1
def test_search(self): instance = self._create_test_data() search.index_entity(instance, index='test_index') error, results, current_cursor, next_cursor = search.search('test_index', '') assert not error assert len(results) == 1
def test_index_and_unindex(self): instance = self._create_test_data() search_index = search_api.Index(name='test_index') search.index_entity(instance, index='test_index') response = search_index.get_range() assert len(response.results) == 1 search.unindex_entity(instance, index='test_index') response = search_index.get_range() assert len(response.results) == 0
def after_put(self, instance): only = self.Model.Meta.search_fields if hasattr(self.Model.Meta, 'search_fields') else None exclude = self.Model.Meta.search_exclude if hasattr(self.Model.Meta, 'search_exclude') else None indexer = self.Model.Meta.search_indexer if hasattr(self.Model.Meta, 'search_indexer') else None converters = self.Model.Meta.search_converters if hasattr(self.Model.Meta, 'search_converters') else None callback = self.Model.Meta.search_callback if hasattr(self.Model.Meta, 'search_callback') else None search.index_entity( instance=instance, index=self._get_index(), only=only, exclude=exclude, indexer=indexer, extra_converters=converters, callback=callback)