def test_add_article_indexes_article_info(self): _create_index() add_article(_article('cooking/indian/madras', [u'spicy', u'curry'], 'this is an awesome article')) add_article(_article('reading/scifi/clarke', [u'monolith', u'alien'], 'this is a crappy article')) commit() # proof that we added it correctly - we can pull it back out with _searcher() as s: results = s.search(_query("tags:spicy")) self.assertEquals(1, len(results)) self.assertIn('cooking/indian/madras', results[0]['article_info_json'])
def test_remove_article_deindexes_article(self): ix = _create_index() writer = ix.writer() article = _article('cooking/indian/madras', [u'spicy', u'curry'], 'this is an awesome article') doc = _field_values(article) writer.add_document(**doc) article = _article('reading/scifi/clarke', [u'monolith', u'alien'], 'this is a crappy article') doc = _field_values(article) writer.add_document(**doc) writer.commit() self.assertEquals(2, _count_total()) remove_article('reading/scifi/clarke') commit() self.assertEquals(1, _count_total())