@Override public boolean indexAccessible(final IndexInfo ii) throws QueryException { final int es = exprs.length; final boolean[] ng = new boolean[es]; int costs = 0; for (final FTExpr expr : exprs) { if (!expr.indexAccessible(ii)) return false; // use worst costs for estimation, as all index results may need to be scanned if (costs < ii.costs) costs = ii.costs; } ii.costs = costs; negated = ng; return true; }
@Override public FTExpr compile(final CompileContext cc) throws QueryException { super.compile(cc); boolean not = true; for (final FTExpr expr : exprs) not &= expr instanceof FTNot; if (not) { // convert (!A and !B and ...) to !(A or B or ...) final int es = exprs.length; for (int e = 0; e < es; ++e) exprs[e] = exprs[e].exprs[0]; return new FTNot(info, new FTOr(info, exprs)); } return this; }
@Override public boolean has(final Flag flag) { for (final FTExpr e : exprs) if (e.has(flag)) return true; return false; }
/** * Checks if sub expressions of a mild not operator violate the grammar. * * @return result of check */ boolean usesExclude() { for (final FTExpr e : exprs) if (e.usesExclude()) return true; return false; }