/// <summary> /// Private helper to delete an item from the index /// </summary> /// <param name="doc">The document representing the item that has to be deleted</param> /// <param name="writer">The Lucene writer</param> private void DeleteItemFromIndex(ADocument doc, IndexWriter writer) { Log.DebugFormat("Deleting item {0} from index", doc); var query = new TermQuery(new Term("Id", doc.Id.ToString())); writer.DeleteDocuments(query); }
/// <summary> /// Private helper to add an item to the Index /// </summary> /// <param name="doc">A ADocument type, representing the values that have to be added to the index</param> /// <param name="writer">The Lucene writer</param> private void AddItemToIndex(ADocument doc, IndexWriter writer) { Log.DebugFormat("Adding document to index: Type {0}"); var query = new TermQuery(new Term("Id", doc.Id.ToString())); writer.DeleteDocuments(query); writer.AddDocument(doc.Document); }
/// <summary> /// Private helper to delete an item from the index /// </summary> /// <param name="doc">The document representing the item that has to be deleted</param> /// <param name="writer">The Lucene writer</param> private void DeleteItemFromIndex(ADocument doc, IndexWriter writer) { Log.DebugFormat("Deleting item {0} from index",doc); var query = new TermQuery(new Term("Id", doc.Id.ToString())); writer.DeleteDocuments(query); }