}
    protected QueryOperation combineOps(QueryOperation other, boolean union)     {        if (union) {            if (hasNoResults()) {                // a query for (other OR nothing) == other                return other;            }            if (other.hasNoResults()) {                return this;            }            if (other instanceof DBQueryOperation) {                DBQueryOperation dbOther = (DBQueryOperation)other;                if (mQueryTarget != null && dbOther.mQueryTarget != null) {                    if (!mQueryTarget.equals(dbOther.mQueryTarget))                        return null;  // can't OR entries with different targets                }                if (mAllResultsQuery)                    return this;                dbOther = (DBQueryOperation)other;                if (dbOther.mAllResultsQuery) // (something OR ALL ) == ALL                    return dbOther;                if (mLuceneOp != null && dbOther.mLuceneOp != null){                    // can't combine                    return null;                }                if (mQueryTarget == null)                    mQueryTarget = dbOther.mQueryTarget;                mConstraints = mConstraints.orIConstraints(dbOther.mConstraints);                return this;            } else {                return null;            }        } else {            if (mAllResultsQuery) {                // we match all results.  (other AND anything) == other                assert(mLuceneOp == null);                if (hasSpamTrashSetting()) {                    other.forceHasSpamTrashSetting();                }                return other;            }            DBQueryOperation dbOther = null;            if (other instanceof DBQueryOperation) {                dbOther = (DBQueryOperation)other;            } else {                return null;            }            if (dbOther.mAllResultsQuery)                return this;            if (mQueryTarget != QueryTarget.UNSPECIFIED && dbOther.mQueryTarget != QueryTarget.UNSPECIFIED) {                if (!mQueryTarget.equals(dbOther.mQueryTarget)) {                    mLog.debug("ANDing two DBOps with different targets -- this is a no results query!");                    return new NullQueryOperation();                }            }            if (mQueryTarget == QueryTarget.UNSPECIFIED)                 mQueryTarget = dbOther.mQueryTarget;            if (mLuceneOp != null) {                if (dbOther.mLuceneOp != null) {                    mLuceneOp.combineOps(dbOther.mLuceneOp, false);                }            } else {                mLuceneOp = dbOther.mLuceneOp;            }            if (mAllResultsQuery && dbOther.mAllResultsQuery) {                mAllResultsQuery = true;            } else {                mAllResultsQuery = false;            }            mConstraints = mConstraints.andIConstraints(dbOther.mConstraints);            return this;        }    }