Esempio n. 1
0
 public void Save()
 {
     var data = PrepareData();
     LuceneIndex db = new LuceneIndex(typeName, directory, mockDocBuilder.Object, mockPathBuilder.Object, Version.LUCENE_30);
     foreach (var d in data)
     {
         db.AddDocument(d);
     }
     db.Save();
     db.Close();
 }
Esempio n. 2
0
        public void Initialize()
        {
            foreach (var kvp in AttributedTypes.SearchTypes)
            {
                var docAttr = kvp.Value;
                var docBuilder = Activator.CreateInstance(docAttr.DocumentBuilder) as IDocumentBuilder;
                var pathBuilder = Activator.CreateInstance(docAttr.IndexPathBuilder) as IIndexPathBuilder;
                var fieldNameProvider = Activator.CreateInstance(docAttr.FacetFieldNameProvider) as IFacetFieldNameProvider;

                var indexer = new LuceneIndex(kvp.Key, directory, docBuilder, pathBuilder, version);
                indexer.Initialize();
                indexers.AddOrUpdate(kvp.Key, indexer, (k, os) => os);

                var searcher = new LuceneSearch(kvp.Key, directory, docBuilder, pathBuilder, fieldNameProvider, version);
                searcher.Initialize();
                searchers.AddOrUpdate(kvp.Key, searcher, (k, os) => os);
            }
        }