IdsQueryBuilder: Allow to add a list in addition to array
In case a developer gets a list of ids from another data source, it does not make a lot of sense, to convert it to an array first, and then internally in IdsQueryBuilder elasticsearch creates a list out of this. Closes #5089
This commit is contained in:
parent
3ac19e8f7f
commit
57a94a151d
|
@ -24,6 +24,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,6 +52,14 @@ public class IdsQueryBuilder extends QueryBuilder implements BoostableQueryBuild
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds ids to the filter.
|
||||||
|
*/
|
||||||
|
public IdsQueryBuilder addIds(Collection<String> ids) {
|
||||||
|
values.addAll(ids);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds ids to the filter.
|
* Adds ids to the filter.
|
||||||
*/
|
*/
|
||||||
|
@ -58,6 +67,13 @@ public class IdsQueryBuilder extends QueryBuilder implements BoostableQueryBuild
|
||||||
return addIds(ids);
|
return addIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds ids to the filter.
|
||||||
|
*/
|
||||||
|
public IdsQueryBuilder ids(Collection<String> ids) {
|
||||||
|
return addIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the boost for this query. Documents matching this query will (in addition to the normal
|
* Sets the boost for this query. Documents matching this query will (in addition to the normal
|
||||||
* weightings) have their score multiplied by the boost provided.
|
* weightings) have their score multiplied by the boost provided.
|
||||||
|
|
Loading…
Reference in New Issue