-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Added synonyms endpoints for the search client (#30)
- Loading branch information
Showing
28 changed files
with
1,041 additions
and
13 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
clients/algoliasearch-client-javascript/client-search/model/clearAllSynonymsResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type ClearAllSynonymsResponse = { | ||
/** | ||
* TaskID of the indexing task to wait for. | ||
*/ | ||
taskID: number; | ||
/** | ||
* Date of last update (ISO-8601 format). | ||
*/ | ||
updatedAt: Date; | ||
}; |
10 changes: 10 additions & 0 deletions
10
clients/algoliasearch-client-javascript/client-search/model/deleteSynonymResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type DeleteSynonymResponse = { | ||
/** | ||
* TaskID of the indexing task to wait for. | ||
*/ | ||
taskID: number; | ||
/** | ||
* Date of deletion (ISO-8601 format). | ||
*/ | ||
deletedAt: Date; | ||
}; |
26 changes: 26 additions & 0 deletions
26
clients/algoliasearch-client-javascript/client-search/model/highlightedSynonym.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export type HighlightedSynonym = { | ||
/** | ||
* Markup text with occurrences highlighted. | ||
*/ | ||
value?: string; | ||
/** | ||
* Indicates how well the attribute matched the search query. | ||
*/ | ||
matchLevel?: HighlightedSynonym.MatchLevelEnum; | ||
/** | ||
* List of words from the query that matched the object. | ||
*/ | ||
matchedWords?: string[]; | ||
/** | ||
* Whether the entire attribute value is highlighted. | ||
*/ | ||
fullyHighlighted?: boolean; | ||
}; | ||
|
||
export namespace HighlightedSynonym { | ||
export enum MatchLevelEnum { | ||
None = 'none', | ||
Partial = 'partial', | ||
Full = 'full', | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
clients/algoliasearch-client-javascript/client-search/model/saveSynonymResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export type SaveSynonymResponse = { | ||
/** | ||
* TaskID of the indexing task to wait for. | ||
*/ | ||
taskID: number; | ||
/** | ||
* Date of last update (ISO-8601 format). | ||
*/ | ||
updatedAt: Date; | ||
/** | ||
* ObjectID of the inserted object. | ||
*/ | ||
id: string; | ||
}; |
10 changes: 10 additions & 0 deletions
10
clients/algoliasearch-client-javascript/client-search/model/saveSynonymsResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export type SaveSynonymsResponse = { | ||
/** | ||
* TaskID of the indexing task to wait for. | ||
*/ | ||
taskID: number; | ||
/** | ||
* Date of last update (ISO-8601 format). | ||
*/ | ||
updatedAt: Date; | ||
}; |
12 changes: 12 additions & 0 deletions
12
clients/algoliasearch-client-javascript/client-search/model/searchSynonymsResponse.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { SynonymHit } from './synonymHit'; | ||
|
||
export type SearchSynonymsResponse = { | ||
/** | ||
* Array of synonym objects. | ||
*/ | ||
hits: SynonymHit[]; | ||
/** | ||
* Number of hits that the search query matched. | ||
*/ | ||
nbHits: number; | ||
}; |
50 changes: 50 additions & 0 deletions
50
clients/algoliasearch-client-javascript/client-search/model/synonymHit.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import type { SynonymHitHighlightResult } from './synonymHitHighlightResult'; | ||
|
||
/** | ||
* Synonym object. | ||
*/ | ||
export type SynonymHit = { | ||
/** | ||
* Unique identifier of the synonym object to be created or updated. | ||
*/ | ||
objectID: string; | ||
/** | ||
* Type of the synonym object. | ||
*/ | ||
type: SynonymHit.TypeEnum; | ||
/** | ||
* Words or phrases to be considered equivalent. | ||
*/ | ||
synonyms?: string[]; | ||
/** | ||
* Word or phrase to appear in query strings (for onewaysynonym). | ||
*/ | ||
input?: string; | ||
/** | ||
* Word or phrase to appear in query strings (for altcorrection1 and altcorrection2). | ||
*/ | ||
word?: string; | ||
/** | ||
* Words to be matched in records. | ||
*/ | ||
corrections?: string[]; | ||
/** | ||
* Token to be put inside records. | ||
*/ | ||
placeholder?: string; | ||
/** | ||
* List of query words that will match the token. | ||
*/ | ||
replacements?: string[]; | ||
_highlightResult?: SynonymHitHighlightResult; | ||
}; | ||
|
||
export namespace SynonymHit { | ||
export enum TypeEnum { | ||
Synonym = 'synonym', | ||
Onewaysynonym = 'onewaysynonym', | ||
Altcorrection1 = 'altcorrection1', | ||
Altcorrection2 = 'altcorrection2', | ||
Placeholder = 'placeholder', | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
clients/algoliasearch-client-javascript/client-search/model/synonymHitHighlightResult.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import type { HighlightResult } from './highlightResult'; | ||
|
||
/** | ||
* Highlighted results. | ||
*/ | ||
export type SynonymHitHighlightResult = { | ||
type?: HighlightResult; | ||
synonyms?: HighlightResult[]; | ||
}; |
10 changes: 10 additions & 0 deletions
10
clients/algoliasearch-client-javascript/client-search/model/synonymType.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** | ||
* Type of the synonym object. | ||
*/ | ||
export enum SynonymType { | ||
Synonym = 'synonym', | ||
Onewaysynonym = 'onewaysynonym', | ||
Altcorrection1 = 'altcorrection1', | ||
Altcorrection2 = 'altcorrection2', | ||
Placeholder = 'placeholder', | ||
} |
Oops, something went wrong.