[TEST] make sure that the random query_string query generator defines a default_field or a list of fields
This commit is contained in:
parent
4a45579506
commit
a4365971a0
|
@ -787,7 +787,7 @@ public class MapperQueryParser extends QueryParser {
|
||||||
fields = context.simpleMatchToIndexNames(field);
|
fields = context.simpleMatchToIndexNames(field);
|
||||||
} else {
|
} else {
|
||||||
Map<String, Float> fieldsAndWeights = settings.fieldsAndWeights();
|
Map<String, Float> fieldsAndWeights = settings.fieldsAndWeights();
|
||||||
fields = fieldsAndWeights == null ? Collections.emptyList() : settings.fieldsAndWeights().keySet();
|
fields = fieldsAndWeights == null ? Collections.emptyList() : fieldsAndWeights.keySet();
|
||||||
}
|
}
|
||||||
return fields;
|
return fields;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,8 +85,7 @@ public class QueryStringQueryBuilderTests extends AbstractQueryTestCase<QueryStr
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
queryStringQueryBuilder.defaultField(randomBoolean() ?
|
queryStringQueryBuilder.defaultField(randomBoolean() ?
|
||||||
STRING_FIELD_NAME : randomAlphaOfLengthBetween(1, 10));
|
STRING_FIELD_NAME : randomAlphaOfLengthBetween(1, 10));
|
||||||
}
|
} else {
|
||||||
if (randomBoolean()) {
|
|
||||||
int numFields = randomIntBetween(1, 5);
|
int numFields = randomIntBetween(1, 5);
|
||||||
for (int i = 0; i < numFields; i++) {
|
for (int i = 0; i < numFields; i++) {
|
||||||
String fieldName = randomBoolean() ? STRING_FIELD_NAME : randomAlphaOfLengthBetween(1, 10);
|
String fieldName = randomBoolean() ? STRING_FIELD_NAME : randomAlphaOfLengthBetween(1, 10);
|
||||||
|
|
Loading…
Reference in New Issue