Skip to content

Commit d5582f5

Browse files
committed
feat: run & rules endpoints
1 parent 7fc5f89 commit d5582f5

File tree

12 files changed

+510
-1
lines changed

12 files changed

+510
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
hit:
2+
type: object
3+
description: |
4+
Search result.
5+
6+
A hit is a record from your index, augmented with special attributes for highlighting, snippeting, and ranking.
7+
x-is-generic: true
8+
additionalProperties: true
9+
required:
10+
- objectID
11+
properties:
12+
objectID:
13+
$ref: '../../../common/parameters.yml#/objectID'
14+
_highlightResult:
15+
$ref: '../../../common/schemas/HighlightResult.yml#/highlightResultMap'
16+
_snippetResult:
17+
$ref: '../../../common/schemas/SnippetResult.yml#/snippetResultMap'
18+
_rankingInfo:
19+
$ref: '../../../common/schemas/Hit.yml#/rankingInfo'
20+
_distinctSeqID:
21+
$ref: '../../../common/schemas/Hit.yml#/distinctSeqID'
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
searchParams:
2+
title: Composition Search parameters as object
3+
type: object
4+
additionalProperties: false
5+
properties:
6+
query:
7+
$ref: '../../../common/schemas/SearchParams.yml#/query'
8+
filters:
9+
$ref: '../../../common/schemas/SearchParams.yml#/filters'
10+
page:
11+
$ref: '#/page'
12+
getRankingInfo:
13+
type: boolean
14+
description: Whether the search response should include detailed ranking information.
15+
relevancyStrictness:
16+
type: integer
17+
facetFilters:
18+
$ref: '../../../common/schemas/SearchParams.yml#/facetFilters'
19+
optionalFilters:
20+
$ref: '../../../common/schemas/SearchParams.yml#/optionalFilters'
21+
numericFilters:
22+
$ref: '../../../common/schemas/SearchParams.yml#/numericFilters'
23+
hitsPerPage:
24+
$ref: '../../../common/schemas/IndexSettings.yml#/hitsPerPage'
25+
aroundLatLng:
26+
$ref: '../../../common/schemas/SearchParams.yml#/aroundLatLng'
27+
aroundLatLngViaIP:
28+
$ref: '../../../common/schemas/SearchParams.yml#/aroundLatLngViaIP'
29+
aroundRadius:
30+
$ref: '../../../common/schemas/SearchParams.yml#/aroundRadius'
31+
aroundPrecision:
32+
$ref: '../../../common/schemas/SearchParams.yml#/aroundPrecision'
33+
minimumAroundRadius:
34+
type: integer
35+
description: Minimum radius (in meters) for a search around a location when `aroundRadius` isn't set.
36+
minimum: 1
37+
x-categories:
38+
- Geo-Search
39+
insideBoundingBox:
40+
$ref: '../../../common/schemas/SearchParams.yml#/insideBoundingBox'
41+
insidePolygon:
42+
$ref: '../../../common/schemas/SearchParams.yml#/insidePolygon'
43+
queryLanguages:
44+
type: array
45+
items:
46+
$ref: '../../../common/schemas/IndexSettings.yml#/supportedLanguage'
47+
example:
48+
- es
49+
description: |
50+
Languages for language-specific query processing steps such as plurals, stop-word removal, and word-detection dictionaries.
51+
52+
This setting sets a default list of languages used by the `removeStopWords` and `ignorePlurals` settings.
53+
This setting also sets a dictionary for word detection in the logogram-based [CJK](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/normalization/#normalization-for-logogram-based-languages-cjk) languages.
54+
To support this, you must place the CJK language **first**.
55+
56+
**You should always specify a query language.**
57+
If you don't specify an indexing language, the search engine uses all [supported languages](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/supported-languages/),
58+
or the languages you specified with the `ignorePlurals` or `removeStopWords` parameters.
59+
This can lead to unexpected search results.
60+
For more information, see [Language-specific configuration](https://www.algolia.com/doc/guides/managing-results/optimize-search-results/handling-natural-languages-nlp/in-depth/language-specific-configurations/).
61+
default: []
62+
x-categories:
63+
- Languages
64+
naturalLanguages:
65+
type: array
66+
items:
67+
$ref: '../../../common/schemas/IndexSettings.yml#/supportedLanguage'
68+
description: |
69+
ISO language codes that adjust settings that are useful for processing natural language queries (as opposed to keyword searches):
70+
71+
- Sets `removeStopWords` and `ignorePlurals` to the list of provided languages.
72+
- Sets `removeWordsIfNoResults` to `allOptional`.
73+
- Adds a `natural_language` attribute to `ruleContexts` and `analyticsTags`.
74+
default: []
75+
x-categories:
76+
- Languages
77+
enableRules:
78+
type: boolean
79+
description: Whether to enable rules.
80+
default: true
81+
x-categories:
82+
- Rules
83+
ruleContexts:
84+
type: array
85+
items:
86+
type: string
87+
description: |
88+
Assigns a rule context to the search query.
89+
90+
[Rule contexts](https://www.algolia.com/doc/guides/managing-results/rules/rules-overview/how-to/customize-search-results-by-platform/#whats-a-context) are strings that you can use to trigger matching rules.
91+
default: []
92+
example: [mobile]
93+
x-categories:
94+
- Rules
95+
userToken:
96+
$ref: '../../../common/schemas/SearchParams.yml#/userToken'
97+
clickAnalytics:
98+
type: boolean
99+
description: |
100+
Whether to include a `queryID` attribute in the response.
101+
102+
The query ID is a unique identifier for a search query and is required for tracking [click and conversion events](https://www.algolia.com/guides/sending-events/getting-started/).
103+
default: false
104+
x-categories:
105+
- Analytics
106+
analytics:
107+
type: boolean
108+
description: Whether this search will be included in Analytics.
109+
default: true
110+
x-categories:
111+
- Analytics
112+
analyticsTags:
113+
type: array
114+
items:
115+
type: string
116+
description: Tags to apply to the query for [segmenting analytics data](https://www.algolia.com/doc/guides/search-analytics/guides/segments/).
117+
default: []
118+
x-categories:
119+
- Analytics
120+
enableABTest:
121+
type: boolean
122+
description: Whether to enable A/B testing for this search.
123+
default: true
124+
x-categories:
125+
- Advanced
126+
enableReRanking:
127+
type: boolean
128+
description: |
129+
Whether this search will use [Dynamic Re-Ranking](https://www.algolia.com/doc/guides/algolia-ai/re-ranking/).
130+
131+
This setting only has an effect if you activated Dynamic Re-Ranking for this index in the Algolia dashboard.
132+
default: true
133+
x-categories:
134+
- Filtering
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
searchResponse:
2+
additionalProperties: true
3+
allOf:
4+
- $ref: '../../../common/schemas/SearchResponse.yml#/baseSearchResponse'
5+
- $ref: '../../../common/schemas/SearchResponse.yml#/SearchPagination'
6+
- $ref: '#/searchHits'
7+
8+
searchHits:
9+
type: object
10+
additionalProperties: true
11+
properties:
12+
hits:
13+
type: array
14+
description: |
15+
Search results (hits).
16+
17+
Hits are records from your index that match the search criteria, augmented with additional attributes, such as, for highlighting.
18+
items:
19+
$ref: 'Hit.yml#/hit'
20+
query:
21+
$ref: '../../../common/schemas/SearchParams.yml#/query'
22+
params:
23+
type: string
24+
description: URL-encoded string of all search parameters.
25+
example: query=a&hitsPerPage=20
26+
required:
27+
- hits
28+
- query
29+
- params

specs/composition/common/schemas/compositionBehavior.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ compositionBehavior:
2525
$ref: '#/compositionInset'
2626
required:
2727
- main
28-
- insets
2928
required:
3029
- injection
3130

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
compositionRule:
2+
type: object
3+
additionalProperties: false
4+
properties:
5+
objectID:
6+
$ref: '../../../common/parameters.yml#/objectID'
7+
conditions:
8+
type: array
9+
minItems: 0
10+
maxItems: 25
11+
description: Conditions that trigger a composition rule.
12+
items:
13+
$ref: '#/condition'
14+
consequence:
15+
title: compositionRuleConsequence
16+
type: object
17+
description: Effect of the rule.
18+
additionalProperties: false
19+
properties:
20+
params:
21+
$ref: './compositionBehavior.yml#/compositionBehavior'
22+
description:
23+
type: string
24+
description: Description of the rule's purpose to help you distinguish between different rules.
25+
example: Display a promotional banner
26+
enabled:
27+
type: boolean
28+
default: true
29+
description: Whether the rule is active.
30+
validity:
31+
type: array
32+
description: Time periods when the rule is active.
33+
items:
34+
$ref: '../../../common/schemas/Rule.yml#/timeRange'
35+
required:
36+
- objectID
37+
- conditions
38+
- consequence
39+
40+
condition:
41+
type: object
42+
additionalProperties: false
43+
properties:
44+
pattern:
45+
type: string
46+
description: |
47+
Query pattern that triggers the rule.
48+
49+
You can use either a literal string, or a special pattern `{facet:ATTRIBUTE}`, where `ATTRIBUTE` is a facet name.
50+
The rule is triggered if the query matches the literal string or a value of the specified facet.
51+
For example, with `pattern: {facet:genre}`, the rule is triggered when users search for a genre, such as "comedy".
52+
example: '{facet:genre}'
53+
anchoring:
54+
$ref: '#/anchoring'
55+
alternatives:
56+
type: boolean
57+
description: Whether the pattern should match plurals, synonyms, and typos.
58+
default: false
59+
context:
60+
$ref: '../../../common/schemas/Rule.yml#/context'
61+
filters:
62+
type: string
63+
description: |
64+
Filters that trigger the rule.
65+
66+
You can add add filters using the syntax `facet:value` so that the rule is triggered, when the specific filter is selected.
67+
You can use `filters` on its own or combine it with the `pattern` parameter.
68+
example: 'genre:comedy'
69+
70+
anchoring:
71+
type: string
72+
description: |
73+
Which part of the search query the pattern should match:
74+
75+
- `startsWith`. The pattern must match the beginning of the query.
76+
- `endsWith`. The pattern must match the end of the query.
77+
- `is`. The pattern must match the query exactly.
78+
- `contains`. The pattern must match anywhere in the query.
79+
80+
Empty queries are only allowed as patterns with `anchoring: is`.
81+
enum: [is, startsWith, endsWith, contains]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
deleteCompositionRuleAction:
2+
type: object
3+
description: Operation arguments when deleting.
4+
additionalProperties: false
5+
properties:
6+
objectID:
7+
$ref: '../../../common/parameters.yml#/objectID'
8+
required:
9+
- objectID
10+
11+
rulesBatchCompositionAction:
12+
oneOf:
13+
- $ref: './compositionRule.yml#/compositionRule'
14+
- $ref: '#/deleteCompositionRuleAction'
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ObjectIDRule:
2+
in: path
3+
name: objectID
4+
description: Unique identifier of a rule object.
5+
required: true
6+
schema:
7+
$ref: '../../../common/parameters.yml#/ruleID'
8+
9+
query:
10+
type: string
11+
description: Search query for rules.
12+
default: ''
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
get:
2+
tags:
3+
- Rules
4+
operationId: getRule
5+
x-acl:
6+
- settings
7+
summary: Retrieve a rule
8+
description: |
9+
Retrieves a rule by its ID.
10+
To find the object ID of rules, use the [`search` operation](#tag/Rules/operation/searchRules).
11+
12+
parameters:
13+
- $ref: '../../common/parameters.yml#/compositionID'
14+
- $ref: './parameters.yml#/ObjectIDRule'
15+
responses:
16+
'200':
17+
description: OK
18+
content:
19+
application/json:
20+
schema:
21+
$ref: '../../common/schemas/compositionRule.yml#/compositionRule'
22+
'400':
23+
$ref: '../../../common/responses/BadRequest.yml'
24+
'402':
25+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
26+
'403':
27+
$ref: '../../../common/responses/MethodNotAllowed.yml'
28+
'404':
29+
$ref: '../../../common/responses/IndexNotFound.yml'
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
post:
2+
tags:
3+
- Rules
4+
operationId: saveRules
5+
x-acl:
6+
- editSettings
7+
summary: Create or update or delete composition rules
8+
description: |
9+
Create or update or delete multiple composition rules.
10+
x-codegen-request-body-name: rules
11+
parameters:
12+
- $ref: '../../common/parameters.yml#/compositionID'
13+
requestBody:
14+
required: true
15+
content:
16+
application/json:
17+
schema:
18+
title: compositionRulesBatchParams
19+
description: Composition rules batch parameters.
20+
type: object
21+
additionalProperties: false
22+
properties:
23+
requests:
24+
type: array
25+
items:
26+
title: rulesMultipleBatchRequest
27+
type: object
28+
additionalProperties: false
29+
properties:
30+
action:
31+
$ref: '../../common/schemas/Batch.yml#/action'
32+
body:
33+
$ref: '../../common/schemas/rulesBatchCompositionAction.yml#/rulesBatchCompositionAction'
34+
required:
35+
- action
36+
- body
37+
responses:
38+
'200':
39+
description: OK
40+
content:
41+
application/json:
42+
schema:
43+
title: rulesMultipleBatchResponse
44+
type: object
45+
additionalProperties: false
46+
properties:
47+
taskID:
48+
$ref: '../../../common/responses/common.yml#/taskID'
49+
required:
50+
- taskID
51+
'400':
52+
$ref: '../../../common/responses/BadRequest.yml'
53+
'402':
54+
$ref: '../../../common/responses/FeatureNotEnabled.yml'
55+
'403':
56+
$ref: '../../../common/responses/MethodNotAllowed.yml'
57+
'404':
58+
$ref: '../../../common/responses/IndexNotFound.yml'

0 commit comments

Comments
 (0)