public void DeletedItems_DoesntShowUp_InSearch() { var item = CreateOneItem <PersistableItem1>(2, "Hello world", root); indexer.Update(item); indexer.Delete(item.ID); var searcher = new LuceneSearcher(accessor, persister); var hits = searcher.Search(Query.For("hello")); Assert.That(hits.Hits.Count(), Is.EqualTo(0)); }
public void AnItemCanBeRemovedFromTheIndex() { TestDataGenerator tdg = new TestDataGenerator(); Directory directory = new RAMDirectory(); Analyzer analyzer = new StandardAnalyzer(Lucene.Net.Util.LuceneVersion.LUCENE_48); _indexer = new LuceneIndexer(directory, analyzer); _indexer.CreateIndex(tdg.AllData); _indexer.Delete(tdg.AllData.First()); Assert.True(tdg.AllData.Count > _indexer.Count()); directory.ClearLock("write.lock"); }
public void Delete() { using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString)) { using (SqlCommand cmd = new SqlCommand("DELETE FROM cms_FAQ WHERE FaqSerial = @FaqSerial", cn)) { cmd.CommandType = CommandType.Text; cmd.Parameters.Add("FaqSerial", SqlDbType.Int).Value = _FaqSerial; cmd.Connection.Open(); cmd.ExecuteNonQuery(); cmd.Connection.Close(); } } // Remove from Lucene search index LuceneIndexer li = new LuceneIndexer(); li.CreateIndexWriter(); li.Delete(FaqID.ToString()); li.Close(); }
public void AnItemCanBeRemovedFromTheIndex() { indexer.Delete(tdg.AllData.First()); Assert.AreEqual(1999, indexer.Count()); }