A BooleanQueryNode represents a list of elements which do not have an explicit boolean operator defined between them. It can be used to express a boolean query that intends to use the default boolean operator.
Наследование: QueryNodeImpl
Пример #1
0
        public override IQueryNode CloneTree()
        {
            BooleanQueryNode clone = (BooleanQueryNode)base.CloneTree();

            // nothing to do here

            return(clone);
        }
Пример #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());
 }
Пример #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(
                Arrays.AsList(nodeA));

            bq.Add(Arrays.AsList(nodeB));
            assertEquals(2, bq.GetChildren().size());
        }
Пример #4
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);
        }
Пример #5
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);
        }
Пример #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);
        }
Пример #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);

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

            booleanNode.Set(Collections.EmptyList <IQueryNode>());
            assertNull(fieldNode.Parent);
        }
Пример #8
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);
        }