@Test
  public void testCorrectOrCondResultWithMultiIndexes() throws Exception {

    Region region = CacheUtils.createRegion("pos", Portfolio.class);
    for (int i = 0; i < 10; i++) {
      region.put("" + i, new Portfolio(i));
    }

    for (int i = 10; i < 20; i++) {
      Portfolio p = new Portfolio(i);
      if (i % 2 == 0) {
        p.status = null;
      }
      region.put("" + i, p);
    }
    QueryService qs;
    qs = CacheUtils.getQueryService();
    String[] queries =
        {"SELECT * FROM " + SEPARATOR
            + "pos pf,  positions.values pos where pf.ID > 0 OR pf.status='active' OR  pos.secId != 'IBM'",
            "SELECT * FROM " + SEPARATOR + "pos pf where pf.ID > 0 OR pf.status='active'",
            "SELECT * FROM " + SEPARATOR + "pos pf where pf.ID > 0 OR pf.status LIKE 'act%'",
            "SELECT DISTINCT * FROM " + SEPARATOR
                + "pos pf where pf.ID > 0 OR pf.status='active' ORDER BY pf.status desc LIMIT 10",
            "SELECT * FROM " + SEPARATOR
                + "pos pf where pf.ID > 0 OR pf.status IN SET('active', 'inactive')",};

    SelectResults[][] sr = new SelectResults[queries.length][2];
    for (int i = 0; i < queries.length; i++) {
      Query q = null;
      try {
        q = CacheUtils.getQueryService().newQuery(queries[i]);
        QueryObserverImpl observer = new QueryObserverImpl();
        QueryObserverHolder.setInstance(observer);
        sr[i][0] = (SelectResults) q.execute();
        if (observer.isIndexesUsed) {
          fail("How could index be present when not created!?");
        }
      } catch (Exception e) {
        e.printStackTrace();
        fail(q.getQueryString());
      }
    }

    // Create an Index on status and execute the same query again.

    qs = CacheUtils.getQueryService();
    Index index1 =
        qs.createIndex("statusIndex", IndexType.FUNCTIONAL, "pf.status", SEPARATOR + "pos pf");
    Index index2 = qs.createIndex("secIdIndex", IndexType.FUNCTIONAL, "pos.secId",
        SEPARATOR + "pos pf, pf.positions.values pos");
    Index index3 = qs.createIndex("IDIndex", IndexType.FUNCTIONAL, "pf.ID", SEPARATOR + "pos pf");

    for (int i = 0; i < queries.length; i++) {
      Query q = null;
      try {
        q = CacheUtils.getQueryService().newQuery(queries[i]);
        QueryObserverImpl observer2 = new QueryObserverImpl();
        QueryObserverHolder.setInstance(observer2);
        sr[i][1] = (SelectResults) q.execute();
        if (!observer2.isIndexesUsed && !queries[i].contains("LIKE")) {
          fail("FAILED: Index NOT Used for query : " + q.getQueryString());
        } else if (!queries[i].contains("LIKE")) {
          assertTrue(observer2.indexesUsed.size() >= 2);
        }
      } catch (Exception e) {
        e.printStackTrace();
        fail(q.getQueryString());
      }
    }

    CacheUtils.compareResultsOfWithAndWithoutIndex(sr, this);
  }
Test verifies the result of query with 'OR' conditions when separate indexes are used for two
comparisons of OR clause. Like, "select * from /portfolio where ID > 0 OR status = 'active'"
and we have indexes on ID and status both. Both indexes must be used.
geode-core/src/integrationTest/java/org/apache/geode/cache/query/functional/IndexWithSngleFrmAndMultCondQryJUnitTest.java