Search in sources :

Example 1 with ExpressionConverter

use of com.yahoo.vespa.indexinglanguage.ExpressionConverter in project vespa by vespa-engine.

the class TextMatch method process.

@Override
public void process(boolean validate) {
    for (SDField field : search.allConcreteFields()) {
        if (field.getMatching().getType() != Matching.Type.TEXT)
            continue;
        ScriptExpression script = field.getIndexingScript();
        if (script == null)
            continue;
        DataType fieldType = field.getDataType();
        if (fieldType instanceof CollectionDataType) {
            fieldType = ((CollectionDataType) fieldType).getNestedType();
        }
        if (fieldType != DataType.STRING)
            continue;
        Set<String> dynamicSummary = new TreeSet<>();
        Set<String> staticSummary = new TreeSet<>();
        new IndexingOutputs(search, deployLogger, rankProfileRegistry, queryProfiles).findSummaryTo(search, field, dynamicSummary, staticSummary);
        MyVisitor visitor = new MyVisitor(dynamicSummary);
        visitor.visit(script);
        if (!visitor.requiresTokenize)
            continue;
        ExpressionConverter converter = new MyStringTokenizer(search, findAnnotatorConfig(search, field));
        field.setIndexingScript((ScriptExpression) converter.convert(script));
    }
}
Also used : SDField(com.yahoo.searchdefinition.document.SDField) TreeSet(java.util.TreeSet) CollectionDataType(com.yahoo.document.CollectionDataType) DataType(com.yahoo.document.DataType) CollectionDataType(com.yahoo.document.CollectionDataType) ExpressionConverter(com.yahoo.vespa.indexinglanguage.ExpressionConverter) ScriptExpression(com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)

Example 2 with ExpressionConverter

use of com.yahoo.vespa.indexinglanguage.ExpressionConverter in project vespa by vespa-engine.

the class PredicateProcessor method addPredicateOptimizationIlScript.

private void addPredicateOptimizationIlScript(SDField field, BooleanIndexDefinition booleanIndexDefiniton) {
    Expression script = field.getIndexingScript();
    if (script == null)
        return;
    script = new StatementExpression(makeSetPredicateVariablesScript(booleanIndexDefiniton), script);
    ExpressionConverter converter = new PredicateOutputTransformer(search);
    field.setIndexingScript(new ScriptExpression((StatementExpression) converter.convert(script)));
}
Also used : ExpressionConverter(com.yahoo.vespa.indexinglanguage.ExpressionConverter)

Aggregations

ExpressionConverter (com.yahoo.vespa.indexinglanguage.ExpressionConverter)2 CollectionDataType (com.yahoo.document.CollectionDataType)1 DataType (com.yahoo.document.DataType)1 SDField (com.yahoo.searchdefinition.document.SDField)1 ScriptExpression (com.yahoo.vespa.indexinglanguage.expressions.ScriptExpression)1 TreeSet (java.util.TreeSet)1