Skip to content

Commit

Permalink
[Backport 2.14] Revert "Removing unused fetch sub phase processor ini…
Browse files Browse the repository at this point in the history
…tialization during fetch… (#12503)" (#13492)

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

This reverts commit da5b205.

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit 5133e5f)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>

* Update 400_inner_hits.yml

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>

---------

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
  • Loading branch information
3 people committed May 2, 2024
1 parent 8e786c2 commit d160ecb
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 121 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,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,68 @@
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":
- skip:
version: " - 2.13.99"
reason: "the regression was fixed in 2.14.0"
- 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;
}
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

This file was deleted.

This file was deleted.

0 comments on commit d160ecb

Please sign in to comment.