Skip to content

Commit 1fe0653

Browse files
committed
search endpoint fixes
1 parent 3004c08 commit 1fe0653

File tree

7 files changed

+71
-8
lines changed

7 files changed

+71
-8
lines changed

specification/_global/search/_types/highlighting.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { Dictionary } from '@spec_utils/Dictionary'
20+
import { Dictionary, SingleKeyDictionary } from '@spec_utils/Dictionary'
2121
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2222
import { Field, Fields } from '@_types/common'
2323
import { integer } from '@_types/Numeric'
@@ -151,7 +151,9 @@ export class HighlightBase {
151151

152152
export class Highlight extends HighlightBase {
153153
encoder?: HighlighterEncoder
154-
fields: Dictionary<Field, HighlightField>
154+
fields:
155+
| SingleKeyDictionary<Field, HighlightField>
156+
| SingleKeyDictionary<Field, HighlightField>[]
155157
}
156158

157159
export enum HighlighterEncoder {

specification/_types/Errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class ErrorCause
3838
/**
3939
* A human-readable explanation of the error, in English.
4040
*/
41-
reason?: string
41+
reason?: string | null
4242
/**
4343
* The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
4444
*/

specification/_types/Retriever.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
*/
1919

2020
import { FieldCollapse } from '@global/search/_types/FieldCollapse'
21+
import { Rescore } from '@global/search/_types/rescoring'
2122
import { UserDefinedValue } from '@spec_utils/UserDefinedValue'
2223
import { QueryVector, QueryVectorBuilder, RescoreVector } from '@_types/Knn'
2324
import { float, integer } from '@_types/Numeric'
@@ -39,6 +40,8 @@ export class RetrieverContainer {
3940
text_similarity_reranker?: TextSimilarityReranker
4041
/** A retriever that replaces the functionality of a rule query. */
4142
rule?: RuleRetriever
43+
/** A retriever that re-scores only the results produced by its child retriever. */
44+
rescorer?: RescorerRetriever
4245
}
4346

4447
export class RetrieverBase {
@@ -48,6 +51,12 @@ export class RetrieverBase {
4851
min_score?: float
4952
}
5053

54+
export class RescorerRetriever extends RetrieverBase {
55+
/** Inner retriever. */
56+
retriever: RetrieverContainer
57+
rescore: Rescore | Rescore[]
58+
}
59+
5160
export class StandardRetriever extends RetrieverBase {
5261
/** Defines a query to retrieve a set of top documents. */
5362
query?: QueryContainer
@@ -105,7 +114,7 @@ export class TextSimilarityReranker extends RetrieverBase {
105114

106115
export class RuleRetriever extends RetrieverBase {
107116
/** The ruleset IDs containing the rules this retriever is evaluating against. */
108-
ruleset_ids: Id[]
117+
ruleset_ids: Id | Id[]
109118
/** The match criteria that will determine if a rule in the provided rulesets should be applied. */
110119
match_criteria: UserDefinedValue
111120
/** The retriever whose results rules should be applied to. */

specification/_types/query_dsl/WeightedTokensQuery.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
* under the License.
1818
*/
1919

20-
import { Dictionary } from '@spec_utils/Dictionary'
20+
import { SingleKeyDictionary } from '@spec_utils/Dictionary'
2121
import { float } from '@_types/Numeric'
2222
import { QueryBase } from './abstractions'
2323
import { TokenPruningConfig } from './TokenPruningConfig'
@@ -27,7 +27,7 @@ import { TokenPruningConfig } from './TokenPruningConfig'
2727
*/
2828
export class WeightedTokensQuery extends QueryBase {
2929
/** The tokens representing this query */
30-
tokens: Dictionary<string, float>
30+
tokens: SingleKeyDictionary<string, float>[]
3131
/** Token pruning configurations */
3232
pruning_config?: TokenPruningConfig
3333
}

specification/_types/query_dsl/fulltext.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export class IntervalsContainer {
103103
* Matches terms that start with a specified set of characters.
104104
*/
105105
prefix?: IntervalsPrefix
106+
range?: IntervalsRange
107+
regexp?: IntervalsRegexp
106108
/**
107109
* Matches terms using a wildcard pattern.
108110
*/
@@ -232,6 +234,52 @@ export class IntervalsPrefix {
232234
use_field?: Field
233235
}
234236

237+
export class IntervalsRange {
238+
/**
239+
* Analyzer used to analyze the `prefix`.
240+
* @doc_id analysis
241+
*/
242+
analyzer?: string
243+
/**
244+
* Lower term, either gte or gt must be provided.
245+
*/
246+
gte?: string
247+
/**
248+
* Lower term, either gte or gt must be provided.
249+
*/
250+
gt?: string
251+
/**
252+
* Upper term, either lte or lt must be provided.
253+
*/
254+
lte?: string
255+
/**
256+
* Upper term, either lte or lt must be provided.
257+
*/
258+
lt?: string
259+
/**
260+
* If specified, match intervals from this field rather than the top-level field.
261+
* The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
262+
*/
263+
use_field?: Field
264+
}
265+
266+
export class IntervalsRegexp {
267+
/**
268+
* Analyzer used to analyze the `prefix`.
269+
* @doc_id analysis
270+
*/
271+
analyzer?: string
272+
/**
273+
* Regex pattern.
274+
*/
275+
pattern: string
276+
/**
277+
* If specified, match intervals from this field rather than the top-level field.
278+
* The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
279+
*/
280+
use_field?: Field
281+
}
282+
235283
/**
236284
* @variants container
237285
* @ext_doc_id query-dsl-intervals-query
@@ -259,6 +307,9 @@ export class IntervalsQuery extends QueryBase {
259307
* Matches terms that start with a specified set of characters.
260308
*/
261309
prefix?: IntervalsPrefix
310+
range?: IntervalsRange
311+
regexp?: IntervalsRegexp
312+
262313
/**
263314
* Matches terms using a wildcard pattern.
264315
*/

specification/_types/query_dsl/geo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class GeoDistanceQuery
9797

9898
/** @variants container */
9999
export class GeoGridQuery extends QueryBase {
100-
geogrid?: GeoTile
100+
geotile?: GeoTile
101101
geohash?: GeoHash
102102
geohex?: GeoHexCell
103103
}

specification/_types/query_dsl/specialized.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ export class ShapeFieldQuery {
400400
*/
401401
export class RuleQuery extends QueryBase {
402402
organic: QueryContainer
403-
ruleset_ids: Id[]
403+
ruleset_ids?: Id | Id[]
404+
ruleset_id?: string
404405
match_criteria: UserDefinedValue
405406
}

0 commit comments

Comments
 (0)