Skip to content

Fix async search apis #1079

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

Merged
merged 3 commits into from
Dec 14, 2021
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
74 changes: 49 additions & 25 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions specification/_global/search/_types/hits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ import { Sort, SortResults } from '@_types/sort'
export class Hit<TDocument> {
_index: IndexName
_id: Id

_score?: double

_score?: double | null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it optional, null, or both? When do we have null values and when do we have no value?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answering my own question after checking the source code: _score and max_score are always there (i.e. not optional) but can indeed be null if no score was calculated because the query was a non-scoring query.

I'll open a follow-up PR to fix this.

_explanation?: Explanation
fields?: Dictionary<string, UserDefinedValue>
highlight?: Dictionary<string, string[]>
Expand All @@ -65,7 +63,7 @@ export class HitsMetadata<T> {
total: TotalHits | long
hits: Hit<T>[]

max_score?: double
max_score?: double | null
}

export class HitMetadata<TDocument> {
Expand Down