示例#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));
 }