@Test
  public void testQueryExecutionMultipleTimes() throws Exception {
    Cache cache = CacheUtils.getCache();
    AttributesFactory attributesFactory = new AttributesFactory();
    RegionAttributes regionAttributes = attributesFactory.create();

    Region region = cache.createRegion("pos", regionAttributes);
    Region region2 = cache.createRegion("pos2", regionAttributes);

    // Create Index
    Index i1 =
        cache.getQueryService().createIndex("status", IndexType.FUNCTIONAL, "ps.status",
            SEPARATOR + "pos ps");
    Index i2 = cache.getQueryService().createIndex("description", IndexType.FUNCTIONAL,
        "ps.description", SEPARATOR + "pos ps");
    Index i3 = cache.getQueryService().createIndex("description2", IndexType.FUNCTIONAL,
        "ps2.description", SEPARATOR + "pos2 ps2");

    for (int i = 0; i < 10; i++) {
      Portfolio p = new Portfolio(i);
      region.put("key-" + i, p);
      region2.put("key-" + i, p);
    }

    executeQueryMultipleTimes(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps WHERE ps.status like 'in%ve'",
        false);
    assertEquals(2, i1.getStatistics().getTotalUses());
    assertEquals(0, i2.getStatistics().getTotalUses());
    assertEquals(0, i3.getStatistics().getTotalUses());

    executeQueryMultipleTimes(
        "SELECT distinct *  FROM " + SEPARATOR
            + "pos ps WHERE ps.status like 'in%ve' or ps.description like 'X%X'",
        false);
    assertEquals(4, i1.getStatistics().getTotalUses());
    assertEquals(2, i2.getStatistics().getTotalUses());
    assertEquals(0, i3.getStatistics().getTotalUses());

    executeQueryMultipleTimes(
        "SELECT distinct *  FROM " + SEPARATOR
            + "pos ps WHERE ps.ID >= 0 and ps.status like 'in%ve'",
        false);
    assertEquals(6, i1.getStatistics().getTotalUses());
    assertEquals(2, i2.getStatistics().getTotalUses());
    assertEquals(0, i3.getStatistics().getTotalUses());

    executeQueryMultipleTimes(
        "SELECT distinct *  FROM " + SEPARATOR + "pos ps1, " + SEPARATOR
            + "pos2 ps2 WHERE ps1.status like 'in%ve' or ps2.description like 'X%X'",
        false);
    assertEquals(8, i1.getStatistics().getTotalUses());
    assertEquals(2, i2.getStatistics().getTotalUses());
    assertEquals(2, i3.getStatistics().getTotalUses());
  }
Test to verify that query executes using index even when the index is being removed during the
execution
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/LikePredicateJUnitTest.java