core/src/main/java/com/orientechnologies/orient/core/sql/OIndexSearchResult.java
public OIndexSearchResult merge(final OIndexSearchResult searchResult) {
    // if (searchResult.lastOperator instanceof OQueryOperatorEquals) {
    if (searchResult.lastOperator instanceof OQueryOperatorEquals) {
      return mergeFields(this, searchResult);
    }
    if (lastOperator instanceof OQueryOperatorEquals) {
      return mergeFields(searchResult, this);
    }
    if (isIndexEqualityOperator(searchResult.lastOperator)) {
      return mergeFields(this, searchResult);
    }
    return mergeFields(searchResult, this);
  }
public OIndexSearchResult merge(final OIndexSearchResult searchResult) {
    // if (searchResult.lastOperator instanceof OQueryOperatorEquals) {
    if (searchResult.lastOperator instanceof OQueryOperatorEquals) {
      return mergeFields(this, searchResult);
    }
    if (lastOperator instanceof OQueryOperatorEquals) {
      return mergeFields(searchResult, this);
    }
    if (isIndexEqualityOperator(searchResult.lastOperator)) {
      return mergeFields(this, searchResult);
    }
    return mergeFields(searchResult, this);
  }
Combines two queries subset into one. This operation will be valid only if {@link #canBeMerged(OIndexSearchResult)} method will
return <code>true</code> for the same passed in parameter.

@param searchResult
Query subset to merge.
@return New instance that presents merged query.