-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Onboard rerank by field processor (#476)
Signed-off-by: Tyler Ohlsen <[email protected]> (cherry picked from commit 4025002) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
55ef260
commit e801d4c
Showing
6 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
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
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
53 changes: 53 additions & 0 deletions
53
public/configs/search_response_processors/rerank_processor.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,53 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { PROCESSOR_TYPE } from '../../../common'; | ||
import { Processor } from '../processor'; | ||
import { generateId } from '../../utils'; | ||
|
||
/** | ||
* The rerank processor config. Used in search flows. | ||
* For now, only supports the by_field type. For details, see | ||
* https://opensearch.org/docs/latest/search-plugins/search-pipelines/rerank-processor/#the-by_field-rerank-type | ||
*/ | ||
export class RerankProcessor extends Processor { | ||
constructor() { | ||
super(); | ||
this.id = generateId('rerank_processor'); | ||
this.type = PROCESSOR_TYPE.RERANK; | ||
this.name = 'Rerank Processor'; | ||
this.fields = [ | ||
{ | ||
id: 'target_field', | ||
type: 'string', | ||
}, | ||
]; | ||
this.optionalFields = [ | ||
{ | ||
id: 'remove_target_field', | ||
type: 'boolean', | ||
value: false, | ||
}, | ||
{ | ||
id: 'keep_previous_score', | ||
type: 'boolean', | ||
value: false, | ||
}, | ||
{ | ||
id: 'tag', | ||
type: 'string', | ||
}, | ||
{ | ||
id: 'description', | ||
type: 'string', | ||
}, | ||
{ | ||
id: 'ignore_failure', | ||
type: 'boolean', | ||
value: false, | ||
}, | ||
]; | ||
} | ||
} |
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
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
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