コード例 #1
0
 public static List<Airline> GetSampleData()
 {
     Airline indigo = new Airline("Indigo Airlines", "IATA001", "A LCC Running domestic passenger flights in India");
     Airline spiceJet = new Airline("SpiceJet", "IATA002", "A LCC Running domestic passenger flights in India");
     Airline airIndia = new Airline("Air India", "IATA003", "A Fully operating airlines operating domestic flights in India, and International flights all over the world");
     return
         (
             new List<Airline>()
             {
                 indigo,
                 spiceJet,
                 airIndia
             }
         );
 }
コード例 #2
0
        private static void _addToLuceneIndex(Airline sampleData, IndexWriter writer)
        {
            // remove older index entry
            var searchQuery = new TermQuery(new Term("Id", sampleData.Name));

            writer.DeleteDocuments(searchQuery);

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

            // add lucene fields mapped to db fields
            doc.Add(new Field("Name", sampleData.Name, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("IataIdentifier", sampleData.IataIdentifier, Field.Store.YES, Field.Index.ANALYZED));
            doc.Add(new Field("Description", sampleData.Description, Field.Store.YES, Field.Index.NOT_ANALYZED));

            // add entry to index
            writer.AddDocument(doc);
        }