예제 #1
0
 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;
 }
예제 #2
0
 @Override
 protected Query visitSymbol(Symbol symbol, Context context) {
   throw new UnsupportedOperationException(
       SymbolFormatter.format("Can't build query from symbol %s", symbol));
 }
예제 #3
0
 private static Query raiseUnsupported(Function function) {
   throw new UnsupportedOperationException(
       SymbolFormatter.format("Cannot convert function %s into a query", function));
 }