private static void _addToLuceneIndex(SiteObject SiteObject, IndexWriter writer) { // add new index entry var doc = new Document(); // add lucene fields mapped to db fields string url = SiteObject.url; string contents = SiteObject.content; int id = SiteObject.id; string title = SiteObject.title; doc.Add(new Field("Id", id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED)); doc.Add(new Field("Url", url, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Contents", contents, Field.Store.YES, Field.Index.ANALYZED)); doc.Add(new Field("Title", title, Field.Store.YES, Field.Index.ANALYZED)); // add entry to index writer.AddDocument(doc); }
// add a single site object public static void AddUpdateLuceneIndex(SiteObject SiteObject) { AddUpdateLuceneIndex(new List <SiteObject> { SiteObject }); }