Search in sources :

Example 1 with EvaluationOnly

use of datawave.query.language.functions.jexl.EvaluationOnly in project datawave by NationalSecurityAgency.

the class LuceneQueryTest method testInit.

// ============================================
// implemented abstract methods
protected void testInit() {
    this.auths = CitiesDataType.getTestAuths();
    this.documentKey = CityField.EVENT_ID.name();
    LuceneToJexlQueryParser parser = new LuceneToJexlQueryParser();
    for (JexlQueryFunction queryFunction : parser.getAllowedFunctions()) {
        if (queryFunction instanceof EvaluationOnly) {
            ((EvaluationOnly) queryFunction).setParser(parser);
            break;
        }
    }
    this.logic.setParser(parser);
}
Also used : EvaluationOnly(datawave.query.language.functions.jexl.EvaluationOnly) JexlQueryFunction(datawave.query.language.functions.jexl.JexlQueryFunction) LuceneToJexlQueryParser(datawave.query.language.parser.jexl.LuceneToJexlQueryParser)

Example 2 with EvaluationOnly

use of datawave.query.language.functions.jexl.EvaluationOnly in project datawave-query-metric-service by NationalSecurityAgency.

the class QueryMetricHandlerConfiguration method luceneToJexlQueryParser.

@Bean
@ConditionalOnMissingBean
public LuceneToJexlQueryParser luceneToJexlQueryParser() {
    LuceneToJexlQueryParser luceneToJexlQueryParser = new LuceneToJexlQueryParser();
    Set<String> skipTokenizedUnfieldedFields = new LinkedHashSet<>();
    skipTokenizedUnfieldedFields.add("DOMETA");
    luceneToJexlQueryParser.setSkipTokenizeUnfieldedFields(skipTokenizedUnfieldedFields);
    Map<String, JexlQueryFunction> allowedFunctions = new LinkedHashMap<>();
    for (JexlQueryFunction f : JexlTreeBuilder.DEFAULT_ALLOWED_FUNCTION_LIST) {
        allowedFunctions.put(f.getClass().getCanonicalName(), f);
    }
    // configure EvaluationOnly with this parser
    EvaluationOnly evaluationOnly = new EvaluationOnly();
    evaluationOnly.setParser(luceneToJexlQueryParser);
    allowedFunctions.put(EvaluationOnly.class.getCanonicalName(), evaluationOnly);
    luceneToJexlQueryParser.setAllowedFunctions(new ArrayList<>(allowedFunctions.values()));
    return luceneToJexlQueryParser;
}
Also used : LinkedHashSet(java.util.LinkedHashSet) EvaluationOnly(datawave.query.language.functions.jexl.EvaluationOnly) JexlQueryFunction(datawave.query.language.functions.jexl.JexlQueryFunction) LuceneToJexlQueryParser(datawave.query.language.parser.jexl.LuceneToJexlQueryParser) LinkedHashMap(java.util.LinkedHashMap) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

EvaluationOnly (datawave.query.language.functions.jexl.EvaluationOnly)2 JexlQueryFunction (datawave.query.language.functions.jexl.JexlQueryFunction)2 LuceneToJexlQueryParser (datawave.query.language.parser.jexl.LuceneToJexlQueryParser)2 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1