@Test
    void testImplicitAndConnectivity() {
        SearchDefinition test = new SearchDefinition("test");
        Index myField = new Index("myfield");
        myField.addCommand("phrase-segmenting false");
        test.addIndex(myField);
        IndexModel indexModel = new IndexModel(test);

        {
            Query query = new Query(httpEncode("?query=myfield:b.c.d"));
            query.getModel().setExecution(new Execution(Execution.Context.createContextStub(new IndexFacts(indexModel))));
            assertEquals("WEAKAND(100) (AND myfield:b myfield:c myfield:d)", query.getModel().getQueryTree().toString());
            WeakAndItem root = (WeakAndItem) query.getModel().getQueryTree().getRoot();
            AndItem and = (AndItem) root.getItem(0);
            WordItem b = (WordItem) and.getItem(0);
            WordItem c = (WordItem) and.getItem(1);
            WordItem d = (WordItem) and.getItem(2);
            assertEquals(c, b.getConnectedItem());
            assertEquals(1.0, b.getConnectivity(), 0.00000001);
            assertEquals(d, c.getConnectedItem());
            assertEquals(1.0, c.getConnectivity(), 0.00000001);
        }

        {
            Query query = new Query(httpEncode("?query=myfield:a myfield:b.c.d myfield:e"));
            query.getModel().setExecution(new Execution(Execution.Context.createContextStub(new IndexFacts(indexModel))));
            assertEquals("WEAKAND(100) myfield:a (AND myfield:b myfield:c myfield:d) myfield:e", query.getModel().getQueryTree().toString());
            WeakAndItem root = (WeakAndItem) query.getModel().getQueryTree().getRoot();
            WordItem a = (WordItem) root.getItem(0);
            AndItem and = (AndItem) root.getItem(1);
            WordItem b = (WordItem) and.getItem(0);
            WordItem c = (WordItem) and.getItem(1);
            WordItem d = (WordItem) and.getItem(2);
            WordItem e = (WordItem) root.getItem(2);
            assertNull(a.getConnectedItem());
            assertEquals(c, b.getConnectedItem());
            assertEquals(1.0, b.getConnectivity(), 0.00000001);
            assertEquals(d, c.getConnectedItem());
            assertEquals(1.0, c.getConnectivity(), 0.00000001);
            assertNull(d.getConnectedItem());
            assertEquals("e", e.getIndexedString());
        }
    }
Test that we get the last value if a parameter is assigned multiple times
container-search/src/test/java/com/yahoo/search/test/QueryTestCase.java