Beispiel #1
0
        public LuceneQueryable(string index_name, int minor_version, bool read_only_mode)
        {
            this.index_name     = index_name;
            this.minor_version  = minor_version;
            this.read_only_mode = read_only_mode;

            driver                  = BuildLuceneQueryingDriver(this.index_name, this.minor_version, this.read_only_mode);
            our_hit_filter          = new LuceneCommon.HitFilter(this.HitFilter);
            backend_query_part_hook = new LuceneCommon.QueryPartHook(this.QueryPartHook);

            // If the queryable is in read-only more, don't
            // instantiate an indexer for it.
            // FIXME: --indexing-delay -1 is a hack for --read-only; need to fix this
            if (read_only_mode || QueryDriver.IndexingDelay < 0)
            {
                return;
            }

            indexer = LocalIndexerHook();
            if (indexer == null && indexer_hook != null)
            {
                indexer = indexer_hook(this.index_name, this.minor_version);
            }

            OptimizeAllEvent += OnOptimizeAllEvent;

            // Schedule an optimize, just in case
            ScheduleOptimize();

            Shutdown.ShutdownEvent += new Shutdown.ShutdownHandler(OnShutdownEvent);
        }
		public LuceneQueryable (string index_name, int minor_version, bool read_only_mode)
		{
			this.index_name = index_name;
			this.minor_version = minor_version;
			this.read_only_mode = read_only_mode;

			driver = BuildLuceneQueryingDriver (this.index_name, this.minor_version, this.read_only_mode);
			our_hit_filter = new LuceneCommon.HitFilter (this.HitFilter);
			backend_query_part_hook = new LuceneCommon.QueryPartHook (this.QueryPartHook);

			// If the queryable is in read-only more, don't 
			// instantiate an indexer for it.
			// FIXME: --indexing-delay -1 is a hack for --read-only; need to fix this
			if (read_only_mode || QueryDriver.IndexingDelay < 0)
				return;

			indexer = LocalIndexerHook ();
			if (indexer == null && indexer_hook != null)
				indexer = indexer_hook (this.index_name, this.minor_version);

			OptimizeAllEvent += OnOptimizeAllEvent;

			// Schedule an optimize, just in case
			ScheduleOptimize ();

			Shutdown.ShutdownEvent += new Shutdown.ShutdownHandler (OnShutdownEvent);
		}