def test_delete_source(self): collection = Collection.by_id(1000) res = self.client.get('/api/2/search?q="mention fruit"') assert res.json['total'] == 1, res.json delete_collection(collection.id) flush_index() res = self.client.get('/api/2/search?q="mention fruit"') assert res.json['total'] == 0, res.json
def test_delete_source(self): collection = Collection.by_id(1000) res = self.client.get('/api/1/query?q="mention fruit"') assert res.json['total'] == 1, res.json delete_collection(collection.id) optimize_search() res = self.client.get('/api/1/query?q="mention fruit"') assert res.json['total'] == 0, res.json
def flush(foreign_id): """Reset the crawler state for a given collecton.""" collection = Collection.by_foreign_id(foreign_id) if collection is None: raise ValueError("No such collection: %r" % foreign_id) delete_collection(collection.id)