Skip to content

Commit

Permalink
Merge branch 'main' into override_search_with_method_for_query_phase_…
Browse files Browse the repository at this point in the history
…searcher

Signed-off-by: Martin Gaievski <gaievski@amazon.com>
  • Loading branch information
martin-gaievski committed May 2, 2024
2 parents af14d56 + 5133e5f commit 837c4a0
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 125 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/),
- [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))
- Refactor implementations of query phase searcher, allow QueryCollectorContext to have zero collectors ([#13481](https://github.com/opensearch-project/OpenSearch/pull/13481))
- [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;
}
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.

0 comments on commit 837c4a0

Please sign in to comment.