@Test
    void testUriIndexAndRestrict() {
        IndexInfoConfig.Builder b = new IndexInfoConfig.Builder();

        IndexInfoConfig.Indexinfo.Builder b1 = new IndexInfoConfig.Indexinfo.Builder();
        b1.name("hasUri");
        IndexInfoConfig.Indexinfo.Command.Builder bb1 = new IndexInfoConfig.Indexinfo.Command.Builder();
        bb1.indexname("url");
        bb1.command("fullurl");
        b1.command(bb1);
        b.indexinfo(b1);

        IndexInfoConfig.Indexinfo.Builder b2 = new IndexInfoConfig.Indexinfo.Builder();
        b2.name("hasNotUri1");
        b.indexinfo(b2);

        IndexInfoConfig.Indexinfo.Builder b3 = new IndexInfoConfig.Indexinfo.Builder();
        b3.name("hasNotUri2");
        b.indexinfo(b3);

        IndexInfoConfig config = new IndexInfoConfig(b);
        IndexFacts indexFacts = new IndexFacts(new IndexModel(config, Map.of()));
        Query query1 = new Query("?query=url:https://foo.bar");
        Query query2 = new Query("?query=url:https://foo.bar&restrict=hasUri");
        assertEquals(0, query1.getModel().getRestrict().size());
        assertEquals(1, query2.getModel().getRestrict().size());
        IndexFacts.Session session1 = indexFacts.newSession(query1.getModel().getSources(), query1.getModel().getRestrict());
        IndexFacts.Session session2 = indexFacts.newSession(query2.getModel().getSources(), query2.getModel().getRestrict());
        assertTrue(session1.getIndex("url").isUriIndex());
        assertTrue(session2.getIndex("url").isUriIndex());
        assertEquals("WEAKAND(100) (AND url:https url:foo url:bar)", query1.getModel().getQueryTree().toString());
        assertEquals("WEAKAND(100) (AND url:https url:foo url:bar)", query2.getModel().getQueryTree().toString());
    }
Tests using synthetic index names for IndexFacts class.

@author Steinar Knutsen
container-search/src/test/java/com/yahoo/prelude/test/IndexFactsTestCase.java