Skip to content

Commit f25e02f

Browse files
committed
fix(specs): types and parameters
1 parent 600fbee commit f25e02f

File tree

8 files changed

+238
-27
lines changed

8 files changed

+238
-27
lines changed

generators/src/main/java/com/algolia/codegen/cts/tests/ParametersWithDataType.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,10 @@ private IJsonSchemaValidationProperties findMatchingOneOf(Object param, CodegenM
546546
}
547547
}
548548
for (CodegenModel oneOf : model.interfaceModels) {
549-
if (oneOf.dataType.equals(paramType)) return oneOf;
549+
// Somehow the dataType can be in lower case?
550+
if (oneOf.dataType.toLowerCase().equals(paramType.toLowerCase())) {
551+
return oneOf;
552+
}
550553
}
551554
return null;
552555
}

specs/common/schemas/IndexSettings.yml

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ baseIndexSettings:
4545
type: string
4646
description: Sets the languages at the index level for language-specific processing such as tokenization and normalization.
4747
default: []
48-
filterPromotes:
49-
type: boolean
50-
description: Whether promoted results should match the filters of the current search, except for geographic filters.
51-
default: false
5248
disablePrefixOnAttributes:
5349
type: array
5450
items:
@@ -65,19 +61,23 @@ baseIndexSettings:
6561
type: string
6662
description: List of numeric attributes that can be used as numerical filters.
6763
default: []
64+
separatorsToIndex:
65+
type: string
66+
description: Control which separators are indexed.
67+
default: ''
68+
searchableAttributes:
69+
type: array
70+
items:
71+
type: string
72+
description: The complete list of attributes used for searching.
73+
default: []
6874
userData:
6975
$ref: '#/userData'
7076

7177
indexSettingsAsSearchParams:
7278
type: object
7379
additionalProperties: false
7480
properties:
75-
searchableAttributes:
76-
type: array
77-
items:
78-
type: string
79-
description: The complete list of attributes used for searching.
80-
default: []
8181
attributesForFaceting:
8282
type: array
8383
items:
@@ -175,18 +175,10 @@ indexSettingsAsSearchParams:
175175
type: string
176176
description: List of attributes on which you want to disable typo tolerance.
177177
default: []
178-
separatorsToIndex:
179-
type: string
180-
description: Control which separators are indexed.
181-
default: ''
182178
ignorePlurals:
183-
type: string
184-
description: Treats singular, plurals, and other forms of declensions as matching terms.
185-
default: false
179+
$ref: '#/ignorePlurals'
186180
removeStopWords:
187-
type: string
188-
description: Removes stop (common) words from the query before executing it.
189-
default: false
181+
$ref: '#/removeStopWords'
190182
keepDiacriticsOnCharacters:
191183
type: string
192184
description: List of characters that the engine shouldn't automatically normalize.
@@ -327,3 +319,35 @@ alternativesAsExact:
327319
advancedSyntaxFeatures:
328320
type: string
329321
enum: [exactPhrase, excludeWords]
322+
323+
ignorePlurals:
324+
description: >
325+
Treats singular, plurals, and other forms of declensions as matching terms.
326+
327+
ignorePlurals is used in conjunction with the queryLanguages setting.
328+
329+
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages.
330+
true: enables the ignore plurals functionality, where singulars and plurals are considered equivalent (foot = feet). The languages supported here are either every language (this is the default, see list of languages below), or those set by queryLanguages.
331+
false: disables ignore plurals, where singulars and plurals are not considered the same for matching purposes (foot will not find feet).
332+
oneOf:
333+
- type: array
334+
items:
335+
type: string
336+
- type: boolean
337+
default: false
338+
339+
removeStopWords:
340+
description: >
341+
Removes stop (common) words from the query before executing it.
342+
343+
removeStopWords is used in conjunction with the queryLanguages setting.
344+
345+
list: language ISO codes for which ignoring plurals should be enabled. This list will override any values that you may have set in queryLanguages.
346+
true: enables the stop word functionality, ensuring that stop words are removed from consideration in a search. The languages supported here are either every language, or those set by queryLanguages.
347+
false: disables stop word functionality, allowing stop words to be taken into account in a search.
348+
oneOf:
349+
- type: array
350+
items:
351+
type: string
352+
- type: boolean
353+
default: false

specs/common/schemas/SearchParams.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,13 @@ baseSearchParams:
8484
type: array
8585
items:
8686
type: number
87+
format: double
8788
description: Search inside a rectangular area (in geo coordinates).
8889
insidePolygon:
8990
type: array
9091
items:
9192
type: number
93+
format: double
9294
description: Search inside a polygon (in geo coordinates).
9395
naturalLanguages:
9496
type: array

specs/predict/paths/fetchUserProfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ post:
4343
type: string
4444
probability:
4545
type: number
46+
format: double
4647
minimum: 0
4748
maximum: 1
4849
lastUpdatedAt:
@@ -53,6 +54,7 @@ post:
5354
properties:
5455
value:
5556
type: number
57+
format: double
5658
minimum: 0
5759
lastUpdatedAt:
5860
type: string
@@ -72,6 +74,7 @@ post:
7274
type: string
7375
probability:
7476
type: number
77+
format: double
7578
minimum: 0
7679
maximum: 1
7780
lastUpdatedAt:

specs/search/common/schemas/SearchQuery.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ searchForFacetsOptions:
2222
indexName:
2323
$ref: '../../../common/parameters.yml#/indexName'
2424
facetQuery:
25-
type: string
26-
description: Text to search inside the facet's values.
27-
default: ''
25+
$ref: '#/facetQuery'
2826
maxFacetHits:
2927
$ref: '../../../common/schemas/IndexSettings.yml#/maxFacetHits'
3028
type:
@@ -34,6 +32,11 @@ searchForFacetsOptions:
3432
- type
3533
- facet
3634

35+
facetQuery:
36+
type: string
37+
description: Text to search inside the facet's values.
38+
default: ''
39+
3740
searchForHitsOptions:
3841
# We provide this option because TypeScript can't distinguish union with optional keys
3942
# if they are not completely the same, see usage in `templates/javascript/model.mustache`

specs/search/paths/search/searchForFacetValues.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ post:
2525
params:
2626
$ref: '../../../common/schemas/SearchParams.yml#/paramsAsString'
2727
facetQuery:
28-
type: string
29-
description: Text to search inside the facet's values.
30-
default: ''
28+
$ref: '../../common/schemas/SearchQuery.yml#/facetQuery'
3129
maxFacetHits:
3230
$ref: '../../../common/schemas/IndexSettings.yml#/maxFacetHits'
3331
responses:

templates/java/oneof_interface.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import com.google.gson.annotations.JsonAdapter;
77
import com.google.gson.stream.JsonReader;
88
import com.google.gson.stream.JsonWriter;
99
import java.io.IOException;
10+
import java.util.List;
1011

1112
@JsonAdapter({{classname}}.Adapter.class)
1213
{{>additionalModelTypeAnnotations}}

tests/CTS/methods/requests/search/search.json

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,5 +192,182 @@
192192
"strategy": "stopIfEnoughMatches"
193193
}
194194
}
195+
},
196+
{
197+
"testName": "search with all search parameters",
198+
"parameters": {
199+
"requests": [
200+
{
201+
"indexName": "theIndexName",
202+
"query": "",
203+
"similarQuery": "",
204+
"filters": "",
205+
"facetFilters": [""],
206+
"optionalFilters": [""],
207+
"numericFilters": [""],
208+
"tagFilters": [""],
209+
"sumOrFiltersScores": true,
210+
"facets": [""],
211+
"maxValuesPerFacet": 0,
212+
"facetingAfterDistinct": true,
213+
"sortFacetValuesBy": "",
214+
"page": 0,
215+
"offset": 0,
216+
"length": 0,
217+
"aroundLatLng": "",
218+
"aroundLatLngViaIP": true,
219+
"aroundRadius": "all",
220+
"aroundPrecision": 0,
221+
"minimumAroundRadius": 0,
222+
"insideBoundingBox": [47.3165, 4.9665],
223+
"insidePolygon": [47.3165, 4.9665],
224+
"naturalLanguages": [""],
225+
"ruleContexts": [""],
226+
"personalizationImpact": 0,
227+
"userToken": "",
228+
"getRankingInfo": true,
229+
"clickAnalytics": true,
230+
"analytics": true,
231+
"analyticsTags": [""],
232+
"percentileComputation": true,
233+
"enableABTest": true,
234+
"enableReRanking": true,
235+
"reRankingApplyFilter": [""],
236+
"attributesForFaceting": [""],
237+
"unretrievableAttributes": [""],
238+
"attributesToRetrieve": [""],
239+
"restrictSearchableAttributes": [""],
240+
"ranking": [""],
241+
"customRanking": [""],
242+
"relevancyStrictness": 0,
243+
"attributesToHighlight": [""],
244+
"attributesToSnippet": [""],
245+
"highlightPreTag": "",
246+
"highlightPostTag": "",
247+
"snippetEllipsisText": "",
248+
"restrictHighlightAndSnippetArrays": true,
249+
"hitsPerPage": 0,
250+
"minWordSizefor1Typo": 0,
251+
"minWordSizefor2Typos": 0,
252+
"typoTolerance": "min",
253+
"allowTyposOnNumericTokens": true,
254+
"disableTypoToleranceOnAttributes": [""],
255+
"ignorePlurals": false,
256+
"removeStopWords": true,
257+
"keepDiacriticsOnCharacters": "",
258+
"queryLanguages": [""],
259+
"decompoundQuery": true,
260+
"enableRules": true,
261+
"enablePersonalization": true,
262+
"queryType": "prefixAll",
263+
"removeWordsIfNoResults": "allOptional",
264+
"advancedSyntax": true,
265+
"optionalWords": [""],
266+
"disableExactOnAttributes": [""],
267+
"exactOnSingleWordQuery": "attribute",
268+
"alternativesAsExact": ["multiWordsSynonym"],
269+
"advancedSyntaxFeatures": ["exactPhrase"],
270+
"distinct": 0,
271+
"synonyms": true,
272+
"replaceSynonymsInHighlight": true,
273+
"minProximity": 0,
274+
"responseFields": [""],
275+
"attributeCriteriaComputedByMinProximity": true,
276+
"renderingContent": {
277+
"string": "any"
278+
},
279+
"type": "default"
280+
}
281+
]
282+
},
283+
"request": {
284+
"path": "/1/indexes/*/queries",
285+
"method": "POST",
286+
"body": {
287+
"requests": [
288+
{
289+
"indexName": "theIndexName",
290+
"query": "",
291+
"similarQuery": "",
292+
"filters": "",
293+
"facetFilters": [""],
294+
"optionalFilters": [""],
295+
"numericFilters": [""],
296+
"tagFilters": [""],
297+
"sumOrFiltersScores": true,
298+
"facets": [""],
299+
"maxValuesPerFacet": 0,
300+
"facetingAfterDistinct": true,
301+
"sortFacetValuesBy": "",
302+
"page": 0,
303+
"offset": 0,
304+
"length": 0,
305+
"aroundLatLng": "",
306+
"aroundLatLngViaIP": true,
307+
"aroundRadius": "all",
308+
"aroundPrecision": 0,
309+
"minimumAroundRadius": 0,
310+
"insideBoundingBox": [47.3165, 4.9665],
311+
"insidePolygon": [47.3165, 4.9665],
312+
"naturalLanguages": [""],
313+
"ruleContexts": [""],
314+
"personalizationImpact": 0,
315+
"userToken": "",
316+
"getRankingInfo": true,
317+
"clickAnalytics": true,
318+
"analytics": true,
319+
"analyticsTags": [""],
320+
"percentileComputation": true,
321+
"enableABTest": true,
322+
"enableReRanking": true,
323+
"reRankingApplyFilter": [""],
324+
"attributesForFaceting": [""],
325+
"unretrievableAttributes": [""],
326+
"attributesToRetrieve": [""],
327+
"restrictSearchableAttributes": [""],
328+
"ranking": [""],
329+
"customRanking": [""],
330+
"relevancyStrictness": 0,
331+
"attributesToHighlight": [""],
332+
"attributesToSnippet": [""],
333+
"highlightPreTag": "",
334+
"highlightPostTag": "",
335+
"snippetEllipsisText": "",
336+
"restrictHighlightAndSnippetArrays": true,
337+
"hitsPerPage": 0,
338+
"minWordSizefor1Typo": 0,
339+
"minWordSizefor2Typos": 0,
340+
"typoTolerance": "min",
341+
"allowTyposOnNumericTokens": true,
342+
"disableTypoToleranceOnAttributes": [""],
343+
"ignorePlurals": false,
344+
"removeStopWords": true,
345+
"keepDiacriticsOnCharacters": "",
346+
"queryLanguages": [""],
347+
"decompoundQuery": true,
348+
"enableRules": true,
349+
"enablePersonalization": true,
350+
"queryType": "prefixAll",
351+
"removeWordsIfNoResults": "allOptional",
352+
"advancedSyntax": true,
353+
"optionalWords": [""],
354+
"disableExactOnAttributes": [""],
355+
"exactOnSingleWordQuery": "attribute",
356+
"alternativesAsExact": ["multiWordsSynonym"],
357+
"advancedSyntaxFeatures": ["exactPhrase"],
358+
"distinct": 0,
359+
"synonyms": true,
360+
"replaceSynonymsInHighlight": true,
361+
"minProximity": 0,
362+
"responseFields": [""],
363+
"attributeCriteriaComputedByMinProximity": true,
364+
"renderingContent": {
365+
"string": "any"
366+
},
367+
"type": "default"
368+
}
369+
]
370+
}
371+
}
195372
}
196373
]

0 commit comments

Comments
 (0)