Ejemplo n.º 1
0
 public static void AddUpdateLuceneIndex(Tag sampleData)
 {
     AddUpdateLuceneIndex(new List<Tag> { sampleData });
 }
Ejemplo n.º 2
0
        private static void addToLuceneIndex(Tag Data, IndexWriter writer)
        {
            var searchQuery = new TermQuery(new Term("Id", Data.Id.ToString()));
            writer.DeleteDocuments(searchQuery);

            var doc = new Document();
            doc.Add(new Field("Id", Data.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("Name", Data.Name, Field.Store.YES, Field.Index.ANALYZED));

            writer.AddDocument(doc);
        }