示例#1
0
        public static SimpleDataIndexer GetSimpleIndexer(Lucene.Net.Store.Directory luceneDir)
        {
            var i = new SimpleDataIndexer(new IndexCriteria(
                                                         new IIndexField[] { },
                                                         new[]
                                                             {
                                                                 new TestIndexField { Name = "Author" },
                                                                 new TestIndexField { Name = "DateCreated", EnableSorting = true, Type = "DateTime"  },
                                                                 new TestIndexField { Name = "Title" },
                                                                 new TestIndexField { Name = "Photographer" },
                                                                 new TestIndexField { Name = "YearCreated", Type = "Date.Year" },
                                                                 new TestIndexField { Name = "MonthCreated", Type = "Date.Month" },
                                                                 new TestIndexField { Name = "DayCreated", Type = "Date.Day" },
                                                                 new TestIndexField { Name = "HourCreated", Type = "Date.Hour" },
                                                                 new TestIndexField { Name = "MinuteCreated", Type = "Date.Minute" },
                                                                 new TestIndexField { Name = "SomeNumber", Type = "Number" },
                                                                 new TestIndexField { Name = "SomeFloat", Type = "Float" },
                                                                 new TestIndexField { Name = "SomeDouble", Type = "Double" },
                                                                 new TestIndexField { Name = "SomeLong", Type = "Long" }
                                                             },
                                                         new string[] { },
                                                         new string[] { },
                                                         -1),
                                                         luceneDir,
                                                         new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29),
                                                         new TestSimpleDataProvider(),
                                                         new[] { "Documents", "Pictures" },
                                                         false);
            i.IndexingError += IndexingError;

            return i;
        }
 public void TestSetup()
 {
     _luceneDir = new RAMDirectory();
     _indexer = IndexInitializer.GetSimpleIndexer(_luceneDir);
     _indexer.RebuildIndex();
     _searcher = IndexInitializer.GetLuceneSearcher(_luceneDir);
 }