Remove MappedFieldType.isSortable(). #17598

It is not really needed.
This commit is contained in:
Adrien Grand 2016-04-07 17:40:03 +02:00
parent a14db8e17e
commit 7ad804fa52
4 changed files with 3 additions and 16 deletions

View File

@ -99,7 +99,7 @@ public abstract class MappedFieldType extends FieldType {
/** Return a fielddata builder for this field. */
public IndexFieldData.Builder fielddataBuilder() {
throw new IllegalArgumentException("Fielddata is not supported on fields of type [" + typeName() + "]");
throw new IllegalArgumentException("Fielddata is not supported on field [" + name() + "] of type [" + typeName() + "]");
}
@Override
@ -222,10 +222,6 @@ public abstract class MappedFieldType extends FieldType {
}
}
public boolean isSortable() {
return true;
}
public String name() {
return name;
}

View File

@ -344,11 +344,6 @@ public class CompletionFieldMapper extends FieldMapper implements ArrayValueMapp
return value.toString();
}
@Override
public boolean isSortable() {
return false;
}
}
/**

View File

@ -263,10 +263,6 @@ public class FieldSortBuilder extends SortBuilder<FieldSortBuilder> {
}
}
if (!fieldType.isSortable()) {
throw new QueryShardException(context, "Sorting not supported for field[" + fieldName + "]");
}
MultiValueMode localSortMode = null;
if (sortMode != null) {
localSortMode = MultiValueMode.fromString(sortMode.toString());

View File

@ -834,7 +834,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase {
fail("Expected an exception due to trying to sort on completion field, but did not happen");
} catch (SearchPhaseExecutionException e) {
assertThat(e.status().getStatus(), is(400));
assertThat(e.toString(), containsString("Sorting not supported for field[" + FIELD + "]"));
assertThat(e.toString(), containsString("Fielddata is not supported on field [" + FIELD + "] of type [completion]"));
}
}
@ -1114,7 +1114,7 @@ public class CompletionSuggestSearchIT extends ESIntegTestCase {
// Exception must be thrown
assertFalse(true);
} catch (SearchPhaseExecutionException e) {
assertThat(e.toString(), containsString("Fielddata is not supported on fields of type [completion]"));
assertThat(e.toString(), containsString("Fielddata is not supported on field [" + FIELD + "] of type [completion]"));
}
}