Skip to content
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

Add Elasticsearch specification for query rules retriever #3078

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
85 changes: 80 additions & 5 deletions output/schema/schema.json

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

8 changes: 8 additions & 0 deletions output/typescript/types.ts

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

15 changes: 15 additions & 0 deletions specification/_types/Retriever.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@
*/

import { FieldCollapse } from '@global/search/_types/FieldCollapse'
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
import { QueryVector, QueryVectorBuilder } from '@_types/Knn'
import { float, integer } from '@_types/Numeric'
import { Sort, SortResults } from '@_types/sort'
import { Id } from './common'
import { QueryContainer } from './query_dsl/abstractions'

/**
Expand All @@ -33,6 +35,8 @@ export class RetrieverContainer {
knn?: KnnRetriever
/** A retriever that produces top documents from reciprocal rank fusion (RRF). */
rrf?: RRFRetriever
/** A retriever that replaces the functionality of a rule query. */
rule?: RuleRetriever
}

export class RetrieverBase {
Expand Down Expand Up @@ -78,3 +82,14 @@ export class RRFRetriever extends RetrieverBase {
/** This value determines the size of the individual result sets per query. */
rank_window_size?: integer
}

export class RuleRetriever extends RetrieverBase {
/** The ruleset IDs containing the rules this retriever is evaluating against. */
ruleset_ids: Id[]
/** The match criteria that will determine if a rule in the provided rulesets should be applied. */
match_criteria: UserDefinedValue
/** The retriever whose results rules should be applied to. */
retriever: RetrieverContainer
/** This value determines the size of the individual result set. */
rank_window_size?: integer
}