All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.elasticsearch.script.DoubleValuesScript Maven / Gradle / Ivy

There is a newer version: 8.13.4
Show newest version
/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License
 * 2.0 and the Server Side Public License, v 1; you may not use this file except
 * in compliance with, at your election, the Elastic License 2.0 or the Server
 * Side Public License, v 1.
 */

package org.elasticsearch.script;

import org.apache.lucene.search.DoubleValues;
import org.apache.lucene.search.DoubleValuesSource;
import org.apache.lucene.search.Rescorer;
import org.apache.lucene.search.SortField;

import java.util.function.Function;

/**
 * A custom script that can be used for various DoubleValue Lucene operations.
 */
public abstract class DoubleValuesScript {

    public DoubleValuesScript() {}

    public abstract double execute();

    public abstract double evaluate(DoubleValues[] functionValues);

    public abstract DoubleValuesSource getDoubleValuesSource(Function sourceProvider);

    public abstract SortField getSortField(Function sourceProvider, boolean reverse);

    public abstract Rescorer getRescorer(Function sourceProvider);

    public abstract String sourceText();

    public abstract String[] variables();

    /** A factory to construct {@link DoubleValuesScript} instances. */
    public interface Factory extends ScriptFactory {
        DoubleValuesScript newInstance();
    }

    @SuppressWarnings("rawtypes")
    public static final ScriptContext CONTEXT = new ScriptContext<>("double_values", Factory.class);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy