private SelectResults doubleBaseCollectionFilterEvaluate(ExecutionContext context,
      SelectResults intermediateResults, boolean completeExpansionNeeded,
      CompiledValue iterOperands, IndexInfo[] indxInfo, RuntimeIterator[] indpdntItrs)
      throws TypeMismatchException, FunctionDomainException,
      NameResolutionException, QueryInvocationTargetException {
    // Asif : First we need to collect the results of the two indexes
    // We will be calling a function of Index & passing the other Index as a
    // parameter.
    // We will be getting List object. Each element of the List will contain a
    // two dimesional
    // Object array. The first row will contain the result objects of the first
    // Index
    // & secondrow will contain that of second index. The object contained in
    // each of the
    // one dimensional array can be either genuine result object or StructImpl
    // object.
    QueryObserver observer = QueryObserverHolder.getInstance();
    context.cachePut(CompiledValue.INDEX_INFO, indxInfo);
    /*
     * Asif : If the independent Group of iterators passed is not null or the independent Group of
     * iterators passed is null & complete expansion flag is true & the intermediate result set is
     * empty or null, in such cases , we have to definitely use indexes on both conditions & go for
     * complete expansion or CompsoiteGroupJunction expansion as be the case. ( ie retaining the old
     * logic of expanding the index result to top or compositeGroupJunction level)
     *
     * The condition in which we sure are to use indexes on both LHS & RHS & the the resultset
     * expanded to CGJ or top level are 1) A stand alone filterable composite condition : In such
     * cases the independent group of itr is passed as null , the intermediate resultset is empty &
     * the complete expansion flag is true. This indicates that we have to expand to top level. 2)
     * Multiple filterable composite condition in OR junction: In such cases the independent grp of
     * its passed is not null but the intermediate resultset is null . This means that indexes on
     * both LHS & RHS to be used & expanded to top or CGJ level ( same as above)
     *
     * The case which is different from above is AND condition evaluation In such cases, till the
     * last but one filerable condition we pass complete expn flag as false & group of indpndt itrs
     * as null. Only last filterabel condn is passed genuine value of expn flag & the not null grp
     * of independent itrs . The intermedaite set is not null & not empty for such cases which wil
     * help us distinguish the case from OR junction
     *
     * IndependentGroup Iterators being null or not null is not a definitive & exclusive * criteria
     * for knowing whether the CC result needs to be expanded to Top or CGJ level as for independent
     * grp not null will happen in OR junction implying expn to CGJ level & ignoring intermediate
     * resultset as well as in evalaution of last filterable condition of AND junction implying
     * usage of intermediate resultset for cartesian.
     *
     * Similarly grp of indpendent itrs can be null for stand alone condition implying expn to top
     * level & ignoring intermediate set & also for evaluating all the conditions except last in AND
     * junction( which means using intermediate resultset for cartesian)
     *
     */
    if ((intermediateResults == null || intermediateResults.isEmpty())
        && (indpdntItrs != null || completeExpansionNeeded)) {
      /*
       * Asif : First obtain the match level of index resultset. If the match level happens to be
       * zero , this implies that we just have to change the StructType ( again if only the Index
       * resultset is a StructBag). If the match level is zero & expand to to top level flag is true
       * & iff the total no. of iterators in current scope is greater than the no. of fields in
       * StructBag , then only we need to do any expansion.
       *
       */
      Support.Assert(_operator == TOK_EQ,
          "A relationship index is not usable for any condition other than equality");

      List data = null;
      try {
        observer.beforeIndexLookup(indxInfo[0]._index, _operator, null);
        observer.beforeIndexLookup(indxInfo[1]._index, _operator, null);
        if (context.getBucketList() != null) {
          data = QueryUtils.queryEquijoinConditionBucketIndexes(indxInfo, context);
        } else {
          data = indxInfo[0]._index.queryEquijoinCondition(indxInfo[1]._index, context);
        }
      } finally {
        observer.afterIndexLookup(data);
      }
      return QueryUtils.getConditionedRelationshipIndexResultsExpandedToTopOrCGJLevel(data,
          indxInfo, context, completeExpansionNeeded, iterOperands, indpdntItrs);
    } else {
      // Asif . We are in this block , this itself guarantees that this
      // conditioned is being called
      // from AND junction evalauation of CompositeGroupJunction . The nature of
      // resultset obtained from here
      // will depend upon the intermediate Resultset passed etc.
      return QueryUtils.getRelationshipIndexResultsMergedWithIntermediateResults(
          intermediateResults, indxInfo, context, completeExpansionNeeded, iterOperands,
          indpdntItrs);
    }
  }
evaluate as a filter, involving a two independent iterators. Use an index if possible on both.
And merge theresults obtained.
geode-core/src/main/java/org/apache/geode/cache/query/internal/CompiledComparison.java