public static void AddUpdateLuceneIndex(User sampleData) { AddUpdateLuceneIndex(new List<User> { sampleData }); }
private static void addToLuceneIndex(User Data, IndexWriter writer) { var searchQuery = new TermQuery(new Term("Id", Data.UserId.ToString())); writer.DeleteDocuments(searchQuery); var doc = new Document(); doc.Add(new Field("Id", Data.UserId.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field("Login", Data.Login, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Email", Data.Email, Field.Store.YES, Field.Index.ANALYZED)); writer.AddDocument(doc); }