Improve error when creating a percolator with no query, closes #669.

This commit is contained in:
kimchy 2011-02-08 11:57:07 +02:00
parent da9f4992e0
commit 37b1415b57
1 changed files with 2 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorer;
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.common.Nullable;
import org.elasticsearch.common.Preconditions;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.collect.ImmutableMap;
import org.elasticsearch.common.collect.MapBuilder;
@ -243,6 +244,7 @@ public class PercolatorExecutor extends AbstractIndexComponent {
}
public synchronized void addQuery(String name, Query query) {
Preconditions.checkArgument(query != null, "query must be provided for percolate request");
this.queries = MapBuilder.newMapBuilder(queries).put(name, query).immutableMap();
}