public void TestSetup() { UmbracoExamineSearcher.DisableInitializationCheck = true; BaseUmbracoIndexer.DisableInitializationCheck = true; //we'll copy over the pdf files first var svc = new TestDataService(); var path = svc.MapPath("/App_Data/Converting_file_to_PDF.pdf"); var f = new FileInfo(path); var dir = f.Directory; //ensure the folder is there System.IO.Directory.CreateDirectory(dir.FullName); var pdfs = new[] { TestFiles.Converting_file_to_PDF, TestFiles.PDFStandards, TestFiles.SurviorFlipCup, TestFiles.windows_vista }; var names = new[] { "Converting_file_to_PDF.pdf", "PDFStandards.pdf", "SurviorFlipCup.pdf", "windows_vista.pdf" }; for (int index = 0; index < pdfs.Length; index++) { var p = pdfs[index]; using (var writer = File.Create(Path.Combine(dir.FullName, names[index]))) { writer.Write(p, 0, p.Length); } } _luceneDir = new RAMDirectory(); _indexer = IndexInitializer.GetPdfIndexer(_luceneDir); _indexer.RebuildIndex(); _searcher = IndexInitializer.GetUmbracoSearcher(_luceneDir); }
public static PDFIndexer GetPdfIndexer(Lucene.Net.Store.Directory luceneDir) { var i = new PDFIndexer(luceneDir, new TestDataService(), new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), false); i.IndexingError += IndexingError; return(i); }