Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Removing unused fetch sub phase processor initialization during fetch… (#12503)" #13486

Merged
merged 1 commit into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Refactoring globMatch using simpleMatchWithNormalizedStrings from Regex ([#13104](https://github.com/opensearch-project/OpenSearch/pull/13104))
- [BWC and API enforcement] Reconsider the breaking changes check policy to detect breaking changes against released versions ([#13292](https://github.com/opensearch-project/OpenSearch/pull/13292))
- Switch to macos-13 runner for precommit and assemble github actions due to macos-latest is now arm64 ([#13412](https://github.com/opensearch-project/OpenSearch/pull/13412))
- [Revert] Prevent unnecessary fetch sub phase processor initialization during fetch phase execution ([#12503](https://github.com/opensearch-project/OpenSearch/pull/12503))

### Deprecated

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
setup:
- do:
indices.create:
index: test_1
body:
settings:
number_of_replicas: 0
mappings:
properties:
list_id:
type: integer
names:
type: nested
properties:
full_name:
type: text

- do:
bulk:
refresh: true
body:
- index:
_index: test_1
_id: 1
- list_id: 1
names:
- full_name: John Doe
- full_name: John Micheal Doe
- index:
_index: test_1
_id: 2
- list_id: 2
names:
- full_name: Jane Doe
- full_name: Jane Michelle Doe

---
"Include inner hits in top hits":
- do:
search:
rest_total_hits_as_int: true
body:
query:
nested:
path: names
query:
match:
names.full_name: Doe
inner_hits: { }
size: 0
aggs:
lists:
terms:
field: list_id
aggs:
top_result:
top_hits:
size: 10

- length: { hits.hits: 0 }
- length: { aggregations.lists.buckets: 2 }
- length: { aggregations.lists.buckets.0.top_result.hits.hits: 1 }
- length: { aggregations.lists.buckets.0.top_result.hits.hits.0.inner_hits.names.hits.hits: 2 }
- length: { aggregations.lists.buckets.1.top_result.hits.hits: 1 }
- length: { aggregations.lists.buckets.1.top_result.hits.hits.0.inner_hits.names.hits.hits: 2 }
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ public boolean includeNamedQueriesScore() {
return searchContext.includeNamedQueriesScore();
}

public boolean hasInnerHits() {
return searchContext.hasInnerHits();
}

/**
* Configuration for returning inner hits
*/
Expand All @@ -217,10 +213,6 @@ public FetchFieldsContext fetchFieldsContext() {
return searchContext.fetchFieldsContext();
}

public boolean hasScriptFields() {
return searchContext.hasScriptFields();
}

/**
* Configuration for script fields
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ public String getName() {
return name;
}

@Override
public boolean hasInnerHits() {
return childInnerHits != null;
}

@Override
public InnerHitsContext innerHits() {
return childInnerHits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public InnerHitsPhase(FetchPhase fetchPhase) {

@Override
public FetchSubPhaseProcessor getProcessor(FetchContext searchContext) {
if (searchContext.hasInnerHits() == false) {
if (searchContext.innerHits() == null) {
return null;
}
reta marked this conversation as resolved.
Show resolved Hide resolved
Map<String, InnerHitsContext.InnerHitSubContext> innerHits = searchContext.innerHits().getInnerHits();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public final class ScriptFieldsPhase implements FetchSubPhase {

@Override
public FetchSubPhaseProcessor getProcessor(FetchContext context) {
if (context.hasScriptFields() == false) {
if (context.scriptFields() == null) {
return null;
}
List<ScriptFieldsContext.ScriptField> scriptFields = context.scriptFields().fields();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,6 @@ public final void close() {

public abstract void highlight(SearchHighlightContext highlight);

public boolean hasInnerHits() {
return innerHitsContext != null;
}

public InnerHitsContext innerHits() {
if (innerHitsContext == null) {
innerHitsContext = new InnerHitsContext();
Expand Down

This file was deleted.

This file was deleted.

Loading