Ejemplo n.º 1
0
        public void TestTags()
        {
            IQueryNode node = new FieldQueryNode("foo", "A", 0, 1);

            node.SetTag("TaG", new Object());
            assertTrue(node.TagMap.size() > 0);
            assertTrue(node.ContainsTag("tAg"));
            assertTrue(node.GetTag("tAg") != null);
        }
Ejemplo n.º 2
0
        public void TestAddChildren()
        {
            IQueryNode       nodeA = new FieldQueryNode("foo", "A", 0, 1);
            IQueryNode       nodeB = new FieldQueryNode("foo", "B", 1, 2);
            BooleanQueryNode bq    = new BooleanQueryNode(
                Arrays.AsList(nodeA));

            bq.Add(Arrays.AsList(nodeB));
            assertEquals(2, bq.GetChildren().size());
        }
Ejemplo n.º 3
0
        public void TestAddChildren()
        {
            IQueryNode       nodeA = new FieldQueryNode("foo", "A", 0, 1);
            IQueryNode       nodeB = new FieldQueryNode("foo", "B", 1, 2);
            BooleanQueryNode bq    = new BooleanQueryNode(
                new IQueryNode[] { nodeA });

            bq.Add(new IQueryNode[] { nodeB });
            assertEquals(2, bq.GetChildren().Count);
        }
Ejemplo n.º 4
0
        public void TestRemoveChildren()
        {
            BooleanQueryNode booleanNode = new BooleanQueryNode(Collections.EmptyList <IQueryNode>());
            FieldQueryNode   fieldNode   = new FieldQueryNode("foo", "A", 0, 1);

            booleanNode.Add(fieldNode);
            assertTrue(booleanNode.GetChildren().Count == 1);

            booleanNode.RemoveChildren(fieldNode);
            assertTrue(booleanNode.GetChildren().Count == 0);
            assertNull(fieldNode.Parent);
        }
Ejemplo n.º 5
0
        public override IQueryNode CloneTree()
        {
            FieldQueryNode fqn = (FieldQueryNode)base.CloneTree();

            fqn.begin                     = this.begin;
            fqn.end                       = this.end;
            fqn.field                     = this.field;
            fqn.text                      = this.text;
            fqn.positionIncrement         = this.positionIncrement;
            fqn.toQueryStringIgnoreFields = this.toQueryStringIgnoreFields;

            return(fqn);
        }
Ejemplo n.º 6
0
        public void TestRemoveFromParent()
        {
            BooleanQueryNode booleanNode = new BooleanQueryNode(Collections.EmptyList <IQueryNode>());
            FieldQueryNode   fieldNode   = new FieldQueryNode("foo", "A", 0, 1);

            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            fieldNode.RemoveFromParent();
            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            booleanNode.Set(Collections.EmptyList <IQueryNode>());
            assertNull(fieldNode.Parent);
        }
Ejemplo n.º 7
0
        public void TestRemoveFromParent()
        {
            BooleanQueryNode booleanNode = new BooleanQueryNode(Collections.EmptyList <IQueryNode>());
            FieldQueryNode   fieldNode   = new FieldQueryNode("foo", "A", 0, 1);

            assertNull(fieldNode.Parent);

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            fieldNode.RemoveFromParent();
            assertNull(fieldNode.Parent);
            /* LUCENE-5805 - QueryNodeImpl.removeFromParent does a lot of work without any effect */
            assertFalse(booleanNode.GetChildren().Contains(fieldNode));

            booleanNode.Add(fieldNode);
            assertNotNull(fieldNode.Parent);

            booleanNode.Set(Collections.EmptyList <IQueryNode>());
            assertNull(fieldNode.Parent);
        }