LUCENE-9340: Remove deprecated SimpleBindings#add(SortField) method

This commit is contained in:
Alan Woodward 2020-04-24 12:17:25 +01:00
parent f6462ee350
commit 5eb117f561
2 changed files with 2 additions and 32 deletions

View File

@ -56,6 +56,8 @@ API Changes
* LUCENE-9307: BufferedIndexInput#setBufferSize has been removed. (Adrien Grand)
* LUCENE-9340: SimpleBindings#add(SortField) has been removed. (Alan Woodward)
Improvements
* LUCENE-8757: When provided with an ExecutorService to run queries across

View File

@ -24,7 +24,6 @@ import java.util.Set;
import java.util.function.Function;
import org.apache.lucene.search.DoubleValuesSource;
import org.apache.lucene.search.SortField;
/**
* Simple class that binds expression variable names to {@link DoubleValuesSource}s
@ -52,20 +51,6 @@ public final class SimpleBindings extends Bindings {
/** Creates a new empty Bindings */
public SimpleBindings() {}
/**
* Adds a SortField to the bindings.
*
* @see DoubleValuesSource#fromIntField(String)
* @see DoubleValuesSource#fromLongField(String)
* @see DoubleValuesSource#fromFloatField(String)
* @see DoubleValuesSource#fromDoubleField(String)
* @see DoubleValuesSource#SCORES
*/
@Deprecated
public void add(SortField sortField) {
map.put(sortField.getField(), bindings -> fromSortField(sortField));
}
/**
* Bind a {@link DoubleValuesSource} directly to the given name.
@ -80,23 +65,6 @@ public final class SimpleBindings extends Bindings {
public void add(String name, Expression expression) {
map.put(name, expression::getDoubleValuesSource);
}
private DoubleValuesSource fromSortField(SortField field) {
switch(field.getType()) {
case INT:
return DoubleValuesSource.fromIntField(field.getField());
case LONG:
return DoubleValuesSource.fromLongField(field.getField());
case FLOAT:
return DoubleValuesSource.fromFloatField(field.getField());
case DOUBLE:
return DoubleValuesSource.fromDoubleField(field.getField());
case SCORE:
return DoubleValuesSource.SCORES;
default:
throw new UnsupportedOperationException();
}
}
@Override
public DoubleValuesSource getDoubleValuesSource(String name) {