1616 * specific language governing permissions and limitations
1717 * under the License.
1818 */
19-
2019import { QueryVector , QueryVectorBuilder , RescoreVector } from '@_types/Knn'
2120import { float , integer } from '@_types/Numeric'
2221import { Sort , SortResults } from '@_types/sort'
2322import { FieldCollapse } from '@global/search/_types/FieldCollapse'
23+ import { Rescore } from '@global/search/_types/rescoring'
2424import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
25- import { Id } from './common'
25+ import { Id , IndexName } from './common'
2626import { QueryContainer } from './query_dsl/abstractions'
2727
2828/**
@@ -39,13 +39,60 @@ export class RetrieverContainer {
3939 text_similarity_reranker ?: TextSimilarityReranker
4040 /** A retriever that replaces the functionality of a rule query. */
4141 rule ?: RuleRetriever
42+ /** A retriever that re-scores only the results produced by its child retriever. */
43+ rescorer ?: RescorerRetriever
44+ /** A retriever that supports the combination of different retrievers through a weighted linear combination. */
45+ linear ?: LinearRetriever
46+ /**
47+ * A pinned retriever applies pinned documents to the underlying retriever.
48+ * This retriever will rewrite to a PinnedQueryBuilder.
49+ */
50+ pinned ?: PinnedRetriever
4251}
4352
4453export class RetrieverBase {
4554 /** Query to filter the documents that can match. */
4655 filter ?: QueryContainer | QueryContainer [ ]
4756 /** Minimum _score for matching documents. Documents with a lower _score are not included in the top documents. */
4857 min_score ?: float
58+ /** Retriever name. */
59+ _name ?: string
60+ }
61+
62+ export class RescorerRetriever extends RetrieverBase {
63+ /** Inner retriever. */
64+ retriever : RetrieverContainer
65+ rescore : Rescore | Rescore [ ]
66+ }
67+
68+ export class LinearRetriever extends RetrieverBase {
69+ /** Inner retrievers. */
70+ retrievers ?: InnerRetriever [ ]
71+ rank_window_size : integer
72+ }
73+
74+ export class PinnedRetriever extends RetrieverBase {
75+ /** Inner retriever. */
76+ retriever : RetrieverContainer
77+ ids ?: string [ ]
78+ docs ?: SpecifiedDocument [ ]
79+ rank_window_size : integer
80+ }
81+
82+ export class InnerRetriever {
83+ retriever : RetrieverContainer
84+ weight : float
85+ normalizer : ScoreNormalizer
86+ }
87+
88+ export enum ScoreNormalizer {
89+ none ,
90+ minmax
91+ }
92+
93+ export class SpecifiedDocument {
94+ index ?: IndexName
95+ id : Id
4996}
5097
5198export class StandardRetriever extends RetrieverBase {
@@ -105,7 +152,7 @@ export class TextSimilarityReranker extends RetrieverBase {
105152
106153export class RuleRetriever extends RetrieverBase {
107154 /** The ruleset IDs containing the rules this retriever is evaluating against. */
108- ruleset_ids : Id [ ]
155+ ruleset_ids : Id | Id [ ]
109156 /** The match criteria that will determine if a rule in the provided rulesets should be applied. */
110157 match_criteria : UserDefinedValue
111158 /** The retriever whose results rules should be applied to. */
0 commit comments