public static void AddUpdateLuceneIndex(LuceneObject sampleData)
 {
     AddUpdateLuceneIndex(new List<LuceneObject> { sampleData });
 }
 public static List<LuceneObject> GetAllPitanja()
 {
     List<DBBL.DAL.Pitanja> pitanja;
     using (Pitanja pt = new Pitanja())
     {
         pitanja = pt.GetAllPitanja();
     }
     List<LuceneObject> lstPitanjeLucne = new List<LuceneObject>();
     foreach (var item in pitanja)
     {
         LuceneObject pt = new LuceneObject();
         pt.Id = item.PitanjeID;
         pt.Name = item.Naziv;
         pt.Description = item.Opis;
         pt.IsQuestion = true;
         lstPitanjeLucne.Add(pt);
     }
     return lstPitanjeLucne;
 }
        /// <summary>
        /// Lucene kreira search index na osnovu podataka u nasem slucaju nase klase PitanjaLucene,
        /// ova metoda kreira jedan search index na osnovu naseg podatka,ona uzme jedan podatak i mapira ga u Lucene class Dokument
        /// i doda seach index uz pomoc index writer-a u fukciji smo dodali Field.Index.ANALYZED samo na Name i Desrcripton properety
        /// iz razloga sto zelimo u pretragi koristi samo ta dva polja jer je to text,ID su jedinstvene vrijednosti pa koje ne zelimo analizirati
        /// pa koristimo Field.Index.NOT_ANALYZED
        /// </summary>
        /// <param name="sampleData"></param>
        /// <param name="writer"></param>
        private static void _addToLuceneIndex(LuceneObject sampleData, IndexWriter writer)
        {
            // remove older index entry
            var searchQuery = new TermQuery(new Term("Id", sampleData.Id.ToString()));
            writer.DeleteDocuments(searchQuery);

            // add new index entry
            var doc = new Document();

            // add lucene fields mapped to db fields
            doc.Add(new Field("Id", sampleData.Id.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
            doc.Add(new Field("Name", sampleData.Name, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("Description", sampleData.Description, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("IsQuestion", sampleData.IsQuestion.ToString(), Field.Store.YES, Field.Index.NOT_ANALYZED));
            // add entry to index
            writer.AddDocument(doc);
        }
 public static List<LuceneObject> GetAllClanke()
 {
     List<LuceneObject> lstClanci = new List<LuceneObject>();
     WikipedEntities context = new WikipedEntities();
     List<Sadrzaji> lstSadrzaji= context.Sadrzaji.ToList();
     foreach (var item in lstSadrzaji)
     {
         LuceneObject temp = new LuceneObject();
         temp.Id = item.SadrzajID;
         temp.Name = item.Naslov;
         temp.Description = item.Tekst;
         temp.IsQuestion = false;
         lstClanci.Add(temp);
     }
     return lstClanci;
 }