public Context convert( WhereClause whereClause, MapperService mapperService, IndexFieldDataService indexFieldDataService, IndexCache indexCache) throws UnsupportedFeatureException { Context ctx = new Context(inputSymbolVisitor, mapperService, indexFieldDataService, indexCache); if (whereClause.noMatch()) { ctx.query = Queries.newMatchNoDocsQuery(); } else if (!whereClause.hasQuery()) { ctx.query = Queries.newMatchAllQuery(); } else { ctx.query = VISITOR.process(whereClause.query(), ctx); } if (LOGGER.isTraceEnabled()) { if (whereClause.hasQuery()) { LOGGER.trace( "WHERE CLAUSE [{}] -> LUCENE QUERY [{}] ", SymbolFormatter.format(whereClause.query()), ctx.query); } } return ctx; }
@Override protected Query visitSymbol(Symbol symbol, Context context) { throw new UnsupportedOperationException( SymbolFormatter.format("Can't build query from symbol %s", symbol)); }
private static Query raiseUnsupported(Function function) { throw new UnsupportedOperationException( SymbolFormatter.format("Cannot convert function %s into a query", function)); }