updated elastic autocomplete to include persons, also adds debounce & clearer handling of response

This commit is contained in:
2025-01-11 13:38:06 +01:00
parent 25da19eaf5
commit fb3b4c8f7d
4 changed files with 155 additions and 56 deletions

View File

@@ -13,6 +13,7 @@ export interface IAutocompleteSearchResults {
timed_out: boolean;
_shards: Shards;
hits: Hits;
suggest: Suggest;
}
export interface Shards {
@@ -37,6 +38,27 @@ export interface Hit {
sort: number[];
}
export interface Suggest {
"movie-suggest": SuggestOptions[];
"person-suggest": SuggestOptions[];
"show-suggest": SuggestOptions[];
}
export interface SuggestOptions {
text: string;
offset: number;
length: number;
options: Option[];
}
export interface Option {
text: string;
_index: string;
_id: string;
_score: number;
_source: Source;
}
export enum Index {
Movies = "movies",
Shows = "shows"
@@ -57,6 +79,8 @@ export interface Source {
agent: Agent;
original_title: string;
original_name?: string;
name?: string;
type?: MediaTypes;
}
export interface Agent {