This query config handler only adds the IUniqueFieldAttribute to it. It does not return any configuration for a field in specific.
Inheritance: Lucene.Net.QueryParsers.Flexible.Core.Config.QueryConfigHandler
        public override void SetUp()
        {
            base.SetUp();

            this.spanProcessorPipeline  = new QueryNodeProcessorPipeline();
            this.spanQueryConfigHandler = new SpansQueryConfigHandler();
            this.spansQueryTreeBuilder  = new SpansQueryTreeBuilder();

            // set up the processor pipeline
            this.spanProcessorPipeline
            .SetQueryConfigHandler(this.spanQueryConfigHandler);

            this.spanProcessorPipeline.Add(new WildcardQueryNodeProcessor());
            this.spanProcessorPipeline.Add(new SpansValidatorQueryNodeProcessor());
            this.spanProcessorPipeline.Add(new UniqueFieldQueryNodeProcessor());
        }
        public void TestBasicDemo()
        {
            ISyntaxParser queryParser = new StandardSyntaxParser();

            // convert the CharSequence into a QueryNode tree
            IQueryNode queryTree = queryParser.Parse("body:text", null);

            // create a config handler with a attribute used in
            // UniqueFieldQueryNodeProcessor
            QueryConfigHandler spanQueryConfigHandler = new SpansQueryConfigHandler();

            spanQueryConfigHandler.Set(SpansQueryConfigHandler.UNIQUE_FIELD, "index");

            // set up the processor pipeline with the ConfigHandler
            // and create the pipeline for this simple demo
            QueryNodeProcessorPipeline spanProcessorPipeline = new QueryNodeProcessorPipeline(
                spanQueryConfigHandler);

            // @see SpansValidatorQueryNodeProcessor
            spanProcessorPipeline.Add(new SpansValidatorQueryNodeProcessor());
            // @see UniqueFieldQueryNodeProcessor
            spanProcessorPipeline.Add(new UniqueFieldQueryNodeProcessor());

            // print to show out the QueryNode tree before being processed
            if (Verbose)
            {
                Console.WriteLine(queryTree);
            }

            // Process the QueryTree using our new Processors
            queryTree = spanProcessorPipeline.Process(queryTree);

            // print to show out the QueryNode tree after being processed
            if (Verbose)
            {
                Console.WriteLine(queryTree);
            }

            // create a instance off the Builder
            SpansQueryTreeBuilder spansQueryTreeBuilder = new SpansQueryTreeBuilder();

            // convert QueryNode tree to span query Objects
            SpanQuery spanquery = (SpanQuery)spansQueryTreeBuilder.Build(queryTree); // LUCENENET TODO: Find a way to remove the cast

            assertTrue(spanquery is SpanTermQuery);
            assertEquals(spanquery.toString(), "index:text");
        }
        public void TestBasicDemo()
        {
            ISyntaxParser queryParser = new StandardSyntaxParser();

            // convert the CharSequence into a QueryNode tree
            IQueryNode queryTree = queryParser.Parse("body:text", null);

            // create a config handler with a attribute used in
            // UniqueFieldQueryNodeProcessor
            QueryConfigHandler spanQueryConfigHandler = new SpansQueryConfigHandler();
            spanQueryConfigHandler.Set(SpansQueryConfigHandler.UNIQUE_FIELD, "index");

            // set up the processor pipeline with the ConfigHandler
            // and create the pipeline for this simple demo
            QueryNodeProcessorPipeline spanProcessorPipeline = new QueryNodeProcessorPipeline(
                spanQueryConfigHandler);
            // @see SpansValidatorQueryNodeProcessor
            spanProcessorPipeline.Add(new SpansValidatorQueryNodeProcessor());
            // @see UniqueFieldQueryNodeProcessor
            spanProcessorPipeline.Add(new UniqueFieldQueryNodeProcessor());

            // print to show out the QueryNode tree before being processed
            if (VERBOSE) Console.WriteLine(queryTree);

            // Process the QueryTree using our new Processors
            queryTree = spanProcessorPipeline.Process(queryTree);

            // print to show out the QueryNode tree after being processed
            if (VERBOSE) Console.WriteLine(queryTree);

            // create a instance off the Builder
            SpansQueryTreeBuilder spansQueryTreeBuilder = new SpansQueryTreeBuilder();

            // convert QueryNode tree to span query Objects
            SpanQuery spanquery = (SpanQuery)spansQueryTreeBuilder.Build(queryTree); // LUCENENET TODO: Find a way to remove the cast

            assertTrue(spanquery is SpanTermQuery);
            assertEquals(spanquery.toString(), "index:text");

        }
Example #4
0
        public override void SetUp()
        {
            base.SetUp();

            this.spanProcessorPipeline = new QueryNodeProcessorPipeline();
            this.spanQueryConfigHandler = new SpansQueryConfigHandler();
            this.spansQueryTreeBuilder = new SpansQueryTreeBuilder();

            // set up the processor pipeline
            this.spanProcessorPipeline
                .SetQueryConfigHandler(this.spanQueryConfigHandler);

            this.spanProcessorPipeline.Add(new WildcardQueryNodeProcessor());
            this.spanProcessorPipeline.Add(new SpansValidatorQueryNodeProcessor());
            this.spanProcessorPipeline.Add(new UniqueFieldQueryNodeProcessor());

        }