Beispiel #1
0
        public override IQueryNode Process(IQueryNode queryTree)
        {
            Analyzer analyzer = GetQueryConfigHandler().Get(ConfigurationKeys.ANALYZER);

            if (analyzer != null)
            {
                this.analyzer = analyzer;
                this.positionIncrementsEnabled = false;
                bool?positionIncrementsEnabled = GetQueryConfigHandler().Get(ConfigurationKeys.ENABLE_POSITION_INCREMENTS);

                // LUCENENET specific - rather than using null, we are relying on the behavior that the default
                // value for an enum is 0 (OR in this case).
                //var defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);
                //this.defaultOperator = defaultOperator != null ? defaultOperator.Value : Operator.OR;
                this.defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);

                if (positionIncrementsEnabled != null)
                {
                    this.positionIncrementsEnabled = positionIncrementsEnabled.Value;
                }

                if (this.analyzer != null)
                {
                    return(base.Process(queryTree));
                }
            }

            return(queryTree);
        }
        public override IQueryNode Process(IQueryNode queryTree)
        {
            var      queryConfigHandler = GetQueryConfigHandler();
            Analyzer analyzer           = queryConfigHandler.Get(ConfigurationKeys.ANALYZER);

            if (analyzer != null)
            {
                this.analyzer = analyzer;
                this.positionIncrementsEnabled = false;

                // LUCENENET specific - rather than using null, we are relying on the behavior that the default
                // value for an enum is 0 (OR in this case).
                this.defaultOperator = GetQueryConfigHandler().Get(ConfigurationKeys.DEFAULT_OPERATOR);

                // LUCENENET: Use TryGetValue() to determine if the value exists
                if (GetQueryConfigHandler().TryGetValue(ConfigurationKeys.ENABLE_POSITION_INCREMENTS, out bool positionIncrementsEnabled))
                {
                    this.positionIncrementsEnabled = positionIncrementsEnabled;
                }

                if (this.analyzer != null)
                {
                    return(base.Process(queryTree));
                }
            }

            return(queryTree);
        }