Skip to content

Commit d1ace7c

Browse files
committed
Revert "Add fieldType to AbstractQueryBuilder and SortBuilder (opensearch-project#15328)"
This reverts commit 839ba0b. Signed-off-by: Ankit Jain <[email protected]>
1 parent eb1cbb8 commit d1ace7c

File tree

46 files changed

+6
-379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+6
-379
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3838
- [Workload Management] Add rejection logic for co-ordinator and shard level requests ([#15428](https://github.com/opensearch-project/OpenSearch/pull/15428)))
3939
- Adding translog durability validation in index templates ([#15494](https://github.com/opensearch-project/OpenSearch/pull/15494))
4040
- Add index creation using the context field ([#15290](https://github.com/opensearch-project/OpenSearch/pull/15290))
41-
- Add fieldType to AbstractQueryBuilder and FieldSortBuilder ([#15328](https://github.com/opensearch-project/OpenSearch/pull/15328)))
4241
- [Reader Writer Separation] Add searchOnly replica routing configuration ([#15410](https://github.com/opensearch-project/OpenSearch/pull/15410))
4342
- [Range Queries] Add new approximateable query framework to short-circuit range queries ([#13788](https://github.com/opensearch-project/OpenSearch/pull/13788))
4443
- [Workload Management] Add query group level failure tracking ([#15227](https://github.com/opensearch-project/OpenSearch/pull/15527))

modules/mapper-extras/src/main/java/org/opensearch/index/query/RankFeatureQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,11 +400,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
400400
builder.endObject();
401401
}
402402

403-
@Override
404-
public final String fieldName() {
405-
return getDefaultFieldName();
406-
}
407-
408403
@Override
409404
protected Query doToQuery(QueryShardContext context) throws IOException {
410405
final MappedFieldType ft = context.fieldMapper(field);

modules/parent-join/src/main/java/org/opensearch/join/query/HasChildQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
264264
builder.endObject();
265265
}
266266

267-
@Override
268-
public final String fieldName() {
269-
return getDefaultFieldName();
270-
}
271-
272267
public static HasChildQueryBuilder fromXContent(XContentParser parser) throws IOException {
273268
float boost = AbstractQueryBuilder.DEFAULT_BOOST;
274269
String childType = null;

modules/parent-join/src/main/java/org/opensearch/join/query/HasParentQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
233233
builder.endObject();
234234
}
235235

236-
@Override
237-
public final String fieldName() {
238-
return getDefaultFieldName();
239-
}
240-
241236
public static HasParentQueryBuilder fromXContent(XContentParser parser) throws IOException {
242237
float boost = AbstractQueryBuilder.DEFAULT_BOOST;
243238
String parentType = null;

modules/parent-join/src/main/java/org/opensearch/join/query/ParentIdQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
130130
builder.endObject();
131131
}
132132

133-
@Override
134-
public final String fieldName() {
135-
return getDefaultFieldName();
136-
}
137-
138133
public static ParentIdQueryBuilder fromXContent(XContentParser parser) throws IOException {
139134
float boost = AbstractQueryBuilder.DEFAULT_BOOST;
140135
String type = null;

modules/percolator/src/main/java/org/opensearch/percolator/PercolateQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
356356
builder.endObject();
357357
}
358358

359-
@Override
360-
public final String fieldName() {
361-
return getDefaultFieldName();
362-
}
363-
364359
private static final ConstructingObjectParser<PercolateQueryBuilder, Void> PARSER = new ConstructingObjectParser<>(NAME, args -> {
365360
String field = (String) args[0];
366361
BytesReference document = (BytesReference) args[1];

server/src/main/java/org/opensearch/index/mapper/FieldTypeLookup.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ class FieldTypeLookup implements Iterable<MappedFieldType> {
101101
}
102102

103103
/**
104-
* Returns the {@link MappedFieldType} for the given field name
105-
* or null if the field name is not found.
104+
* Returns the mapped field type for the given field name.
106105
*/
107106
public MappedFieldType get(String field) {
108107
String concreteField = aliasToConcreteName.getOrDefault(field, field);

server/src/main/java/org/opensearch/index/mapper/MapperService.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,8 +632,7 @@ public DocumentMapperForType documentMapperWithAutoCreate() {
632632
}
633633

634634
/**
635-
* Given the full name of a field, returns its {@link MappedFieldType}
636-
* or null if the field is not found.
635+
* Given the full name of a field, returns its {@link MappedFieldType}.
637636
*/
638637
public MappedFieldType fieldType(String fullName) {
639638
return this.mapper == null ? null : this.mapper.fieldTypes().get(fullName);

server/src/main/java/org/opensearch/index/query/AbstractQueryBuilder.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public abstract class AbstractQueryBuilder<QB extends AbstractQueryBuilder<QB>>
7474
public static final ParseField BOOST_FIELD = new ParseField("boost");
7575

7676
protected String queryName;
77-
protected String fieldType;
7877
protected float boost = DEFAULT_BOOST;
7978

8079
protected AbstractQueryBuilder() {
@@ -113,27 +112,6 @@ protected void printBoostAndQueryName(XContentBuilder builder) throws IOExceptio
113112
}
114113
}
115114

116-
/**
117-
* Returns field name as String.
118-
* Abstract method to be implemented by all child classes.
119-
*/
120-
public abstract String fieldName();
121-
122-
/**
123-
* Default method for child classes which do not have a custom {@link #fieldName()} implementation.
124-
*/
125-
protected static String getDefaultFieldName() {
126-
return null;
127-
};
128-
129-
/**
130-
* Returns field type as String for QueryBuilder classes which have a defined fieldName.
131-
* Else returns null.
132-
*/
133-
public final String getFieldType() {
134-
return fieldType;
135-
};
136-
137115
@Override
138116
public final Query toQuery(QueryShardContext context) throws IOException {
139117
Query query = doToQuery(context);
@@ -147,7 +125,6 @@ public final Query toQuery(QueryShardContext context) throws IOException {
147125
context.addNamedQuery(queryName, query);
148126
}
149127
}
150-
fieldType = context.getFieldTypeString(fieldName());
151128
return query;
152129
}
153130

server/src/main/java/org/opensearch/index/query/BoolQueryBuilder.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,11 +270,6 @@ protected void doXContent(XContentBuilder builder, Params params) throws IOExcep
270270
builder.endObject();
271271
}
272272

273-
@Override
274-
public final String fieldName() {
275-
return getDefaultFieldName();
276-
}
277-
278273
private static void doXArrayContent(ParseField field, List<QueryBuilder> clauses, XContentBuilder builder, Params params)
279274
throws IOException {
280275
if (clauses.isEmpty()) {

0 commit comments

Comments
 (0)