private void AddItemToIndex(AbstactDocument doc, IndexWriter writer) { var query = new BooleanQuery(); query.Add(new TermQuery(new Term("Id", doc.Id.ToString())), Occur.MUST); query.Add(new TermQuery(new Term("Type", doc.Type)), Occur.MUST); writer.DeleteDocuments(query); writer.AddDocument(doc.Document); }
private void DeleteItemFromIndex(AbstactDocument doc, IndexWriter writer) { var query = new TermQuery(new Term("Id", doc.Id.ToString())); writer.DeleteDocuments(query); }