use of org.apache.lucene.queries.function.valuesource.SimpleFloatFunction in project lucene-solr by apache.
the class DummyValueSourceParser method parse.
@Override
public ValueSource parse(FunctionQParser fp) throws SyntaxError {
ValueSource source = fp.parseValueSource();
ValueSource result = new SimpleFloatFunction(source) {
@Override
protected String name() {
return "foo";
}
@Override
protected float func(int doc, FunctionValues vals) {
float result = 0;
return result;
}
};
return result;
}
use of org.apache.lucene.queries.function.valuesource.SimpleFloatFunction in project lucene-solr by apache.
the class NvlValueSourceParser method parse.
@Override
public ValueSource parse(FunctionQParser fp) throws SyntaxError {
ValueSource source = fp.parseValueSource();
final float nvl = fp.parseFloat();
return new SimpleFloatFunction(source) {
@Override
protected String name() {
return "nvl";
}
@Override
protected float func(int doc, FunctionValues vals) throws IOException {
float v = vals.floatVal(doc);
if (v == nvlFloatValue) {
return nvl;
} else {
return v;
}
}
};
}
Aggregations