Multi Match: Wrongly defaults to dis_max instead of bool

fixes #2397
This commit is contained in:
Shay Banon 2012-11-10 14:59:45 +01:00
parent f33e353259
commit edaa65dba2
2 changed files with 4 additions and 7 deletions

View File

@ -19,7 +19,6 @@
package org.elasticsearch.index.query; package org.elasticsearch.index.query;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery; import org.apache.lucene.search.BooleanQuery;
@ -33,7 +32,6 @@ import org.elasticsearch.index.search.MatchQuery;
import org.elasticsearch.index.search.MultiMatchQuery; import org.elasticsearch.index.search.MultiMatchQuery;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -146,7 +144,7 @@ public class MultiMatchQueryParser implements QueryParser {
} else if ("use_dis_max".equals(currentFieldName) || "useDisMax".equals(currentFieldName)) { } else if ("use_dis_max".equals(currentFieldName) || "useDisMax".equals(currentFieldName)) {
multiMatchQuery.setUseDisMax(parser.booleanValue()); multiMatchQuery.setUseDisMax(parser.booleanValue());
} else if ("tie_breaker".equals(currentFieldName) || "tieBreaker".equals(currentFieldName)) { } else if ("tie_breaker".equals(currentFieldName) || "tieBreaker".equals(currentFieldName)) {
multiMatchQuery.setTieBreaker(parser.intValue()); multiMatchQuery.setTieBreaker(parser.floatValue());
} else if ("lenient".equals(currentFieldName)) { } else if ("lenient".equals(currentFieldName)) {
multiMatchQuery.setLenient(parser.booleanValue()); multiMatchQuery.setLenient(parser.booleanValue());
} else { } else {

View File

@ -25,19 +25,18 @@ import org.apache.lucene.search.DisjunctionMaxQuery;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.elasticsearch.index.query.QueryParseContext; import org.elasticsearch.index.query.QueryParseContext;
import java.util.List;
import java.util.Map; import java.util.Map;
public class MultiMatchQuery extends MatchQuery { public class MultiMatchQuery extends MatchQuery {
private boolean useDisMax = true; private boolean useDisMax = true;
private int tieBreaker; private float tieBreaker;
public void setUseDisMax(boolean useDisMax) { public void setUseDisMax(boolean useDisMax) {
this.useDisMax = useDisMax; this.useDisMax = useDisMax;
} }
public void setTieBreaker(int tieBreaker) { public void setTieBreaker(float tieBreaker) {
this.tieBreaker = tieBreaker; this.tieBreaker = tieBreaker;
} }