Esempio n. 1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            Searcher = new SearcherContext(FSDirectory.Open(HostingEnvironment.MapPath("~/App_Data/Index")),
                new WhitespaceAnalyzer());
        }
Esempio n. 2
0
        public static void SetIndexPath(string directory, string searchApiEndpoint)
        {
            if (String.IsNullOrEmpty(directory)) throw new ArgumentNullException("directory", "Please specify the directory for the search indexes");
            if (!System.IO.Directory.Exists(directory))
                System.IO.Directory.CreateDirectory(directory);
            SearchIndexDir = FSDirectory.Open(new DirectoryInfo(Path.Combine(directory, DefaultSearchIndexPath)));
            SpellIndexDir = FSDirectory.Open(new DirectoryInfo(Path.Combine(directory, DefaultSpellIndexPath)));

            Searcher = new SearcherContext(SearchIndexDir, DefaultAnalyzer);

            SearchApiEndpoint = searchApiEndpoint;
        }
Esempio n. 3
0
        private NrtManager GetWriter()
        {
            if(_writer == null)
            {
                _writer = new SearcherContext(_directory, _analyzer);
            }

            // Once we have the writer that takes over!
            if(_reader != null)
            {
                // Note: we are specifically not disposing here so that any queries can finish on the old reader
                _reader = null;
            }

            return _writer.Manager;
        }