Skip to content

Commit

Permalink
fix(specs): recommend remove unsupported query parameters [RECO-2345]…
Browse files Browse the repository at this point in the history
… [skip-bc] (#3692)
  • Loading branch information
raed667 authored Sep 19, 2024
1 parent cc190fa commit 1a73994
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 29 deletions.
6 changes: 5 additions & 1 deletion clients/algoliasearch-client-dart/melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,15 @@ scripts:
exec: dart pub upgrade
description: Run `dart pub upgrade` in all packages

outdated:
exec: dart pub outdated
description: Run `dart pub outdated` in all packages

clear:
exec: rm -rf .dart_tool
description: Clear build folders, i.e. `.dart_tool` in all packages

command:
version:
hooks:
post: ./sync.sh
post: ./sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
"aroundradiusall",
"automaticfacetfilter",
"automaticfacetfilters",
"baseindexsettings",
"basesearchparams",
"basesearchparamswithoutquery",
"basesearchresponse",
Expand Down Expand Up @@ -84,8 +85,8 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
"range",
"rankinginfo",
"redirect",
"redirectruleindexmetadata",
"redirectruleindexdata",
"redirectruleindexmetadata",
"redirecturl",
"region",
"removestopwords",
Expand Down
6 changes: 3 additions & 3 deletions scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ export async function runCts(
): Promise<void> {
const withBenchmarkServer =
suites.benchmark && (clients.includes('search') || clients.includes('all') || languages.includes('swift'));
const withClientServer =
suites.client && (clients.includes('search') || clients.includes('all') || process.platform === 'darwin'); // the macos swift CI also runs the clients tests
const withClientServer = suites.client;
const closeTestServer = await startTestServer({
...suites,
benchmark: withBenchmarkServer,
Expand All @@ -142,7 +141,8 @@ export async function runCts(

await closeTestServer();

if (withClientServer) {
if (withClientServer && (clients.includes('search') || clients.includes('all') || process.platform === 'darwin')) {
// the macos swift CI also runs the clients tests
const skip = (lang: Language): number => (languages.includes(lang) ? 1 : 0);

assertValidTimeouts(languages.length);
Expand Down
88 changes: 88 additions & 0 deletions specs/recommend/common/schemas/IndexSettings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
recommendIndexSettings:
description: Index settings.
allOf:
- $ref: '../../../common/schemas/IndexSettings.yml#/baseIndexSettings'
- $ref: '#/baseRecommendIndexSettings'

baseRecommendIndexSettings:
type: object
additionalProperties: false
properties:
attributesToRetrieve:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/attributesToRetrieve'
ranking:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/ranking'
relevancyStrictness:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/relevancyStrictness'
attributesToHighlight:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/attributesToHighlight'
attributesToSnippet:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/attributesToSnippet'
highlightPreTag:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/highlightPreTag'
highlightPostTag:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/highlightPostTag'
snippetEllipsisText:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/snippetEllipsisText'
restrictHighlightAndSnippetArrays:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/restrictHighlightAndSnippetArrays'
minWordSizefor1Typo:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/minWordSizefor1Typo'
minWordSizefor2Typos:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/minWordSizefor2Typos'
typoTolerance:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/typoTolerance'
allowTyposOnNumericTokens:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/allowTyposOnNumericTokens'
disableTypoToleranceOnAttributes:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/disableTypoToleranceOnAttributes'
ignorePlurals:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/ignorePlurals'
removeStopWords:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/removeStopWords'
queryLanguages:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/queryLanguages'
decompoundQuery:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/decompoundQuery'
enableRules:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/enableRules'
enablePersonalization:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/enablePersonalization'
queryType:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/queryType'
removeWordsIfNoResults:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/removeWordsIfNoResults'
advancedSyntax:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/advancedSyntax'
optionalWords:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/optionalWords'
disableExactOnAttributes:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/disableExactOnAttributes'
exactOnSingleWordQuery:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/exactOnSingleWordQuery'
alternativesAsExact:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/alternativesAsExact'
advancedSyntaxFeatures:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/advancedSyntaxFeatures'
distinct:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/distinct'
replaceSynonymsInHighlight:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/replaceSynonymsInHighlight'
minProximity:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/minProximity'
responseFields:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/responseFields'
maxFacetHits:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/maxFacetHits'
maxValuesPerFacet:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/maxValuesPerFacet'
sortFacetValuesBy:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/sortFacetValuesBy'
attributeCriteriaComputedByMinProximity:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/attributeCriteriaComputedByMinProximity'
renderingContent:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/renderingContent'
enableReRanking:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/enableReRanking'
reRankingApplyFilter:
$ref: '../../../common/schemas/IndexSettings.yml#/indexSettingsAsSearchParams/properties/reRankingApplyFilter'
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/LookingSimilarQuery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lookingSimilar:
objectID:
$ref: '../../../common/parameters.yml#/objectID'
fallbackParameters:
$ref: './RecommendationsRequest.yml#/fallbackParams'
$ref: './QueryParameters.yml#/fallbackParams'
required:
- model
- objectID
Expand Down
75 changes: 75 additions & 0 deletions specs/recommend/common/schemas/QueryParameters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
recommendSearchParams:
title: Search parameters as object
description: Search parameters for filtering the recommendations.
allOf:
- $ref: '#/baseRecommendSearchParams'
- $ref: '../../../common/schemas/SearchParams.yml#/searchParamsQuery'
- $ref: './IndexSettings.yml#/recommendIndexSettings'

fallbackParams:
title: fallbackParameters
allOf:
- $ref: './QueryParameters.yml#/recommendSearchParams'
- type: object
description: Search parameters to use for a fallback request if there aren't enough recommendations.

baseRecommendSearchParams:
type: object
additionalProperties: false
properties:
similarQuery:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/similarQuery'
filters:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/filters'
facetFilters:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/facetFilters'
optionalFilters:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/optionalFilters'
numericFilters:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/numericFilters'
tagFilters:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/tagFilters'
sumOrFiltersScores:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/sumOrFiltersScores'
restrictSearchableAttributes:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/restrictSearchableAttributes'
facets:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/facets'
facetingAfterDistinct:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/facetingAfterDistinct'
aroundLatLng:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/aroundLatLng'
aroundLatLngViaIP:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/aroundLatLngViaIP'
aroundRadius:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/aroundRadius'
aroundPrecision:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/aroundPrecision'
minimumAroundRadius:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/minimumAroundRadius'
insideBoundingBox:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/insideBoundingBox'
insidePolygon:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/insidePolygon'
naturalLanguages:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/naturalLanguages'
ruleContexts:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/ruleContexts'
personalizationImpact:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/personalizationImpact'
userToken:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/userToken'
getRankingInfo:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/getRankingInfo'
synonyms:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/synonyms'
clickAnalytics:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/clickAnalytics'
analytics:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/analytics'
analyticsTags:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/analyticsTags'
percentileComputation:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/percentileComputation'
enableABTest:
$ref: '../../../common/schemas/SearchParams.yml#/baseSearchParamsWithoutQuery/properties/enableABTest'
4 changes: 2 additions & 2 deletions specs/recommend/common/schemas/RecommendRule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Condition:
If not specified, the rule is triggered for all recommendations.
properties:
filters:
$ref: '../../../common/schemas/SearchParams.yml#/filters'
$ref: './QueryParameters.yml#/baseRecommendSearchParams/properties/filters'
context:
$ref: '../../../common/schemas/Rule.yml#/context'

Expand Down Expand Up @@ -89,7 +89,7 @@ ParamsConsequence:
items:
$ref: '#/AutoFacetFilter'
filters:
$ref: '../../../common/schemas/SearchParams.yml#/filters'
$ref: './QueryParameters.yml#/baseRecommendSearchParams/properties/filters'
optionalFilters:
type: array
description: |
Expand Down
17 changes: 1 addition & 16 deletions specs/recommend/common/schemas/RecommendationsRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,7 @@ baseRecommendRequest:
Depending on the available recommendations and the other request parameters,
the actual number of recommendations may be lower than this value.
queryParameters:
$ref: '#/searchParams'
$ref: './QueryParameters.yml#/recommendSearchParams'
required:
- indexName
- threshold

searchParams:
title: queryParameters
allOf:
# TODO: This isn't correct. `page`, `hitsPerPage`, `offset`, and `length` aren't allowed
- $ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
- type: object
description: Search parameters for filtering the recommendations.

fallbackParams:
title: fallbackParameters
allOf:
- $ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
- type: object
description: Search parameters to use for a fallback request if there aren't enough recommendations.
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/RecommendedForYouQuery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ recommendedForYou:
model:
$ref: '#/recommendedForYouModel'
fallbackParameters:
$ref: './RecommendationsRequest.yml#/fallbackParams'
$ref: './QueryParameters.yml#/fallbackParams'
required:
- model

Expand Down
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/RelatedQuery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ relatedProducts:
objectID:
$ref: '../../../common/parameters.yml#/objectID'
fallbackParameters:
$ref: './RecommendationsRequest.yml#/fallbackParams'
$ref: './QueryParameters.yml#/fallbackParams'
required:
- model
- objectID
Expand Down
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/TrendingFacetsQuery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ trendingFacets:
model:
$ref: '#/trendingFacetsModel'
fallbackParameters:
$ref: './RecommendationsRequest.yml#/fallbackParams'
$ref: './QueryParameters.yml#/fallbackParams'
required:
- facetName
- model
Expand Down
2 changes: 1 addition & 1 deletion specs/recommend/common/schemas/TrendingItemsQuery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ trendingItems:
model:
$ref: '#/trendingItemsModel'
fallbackParameters:
$ref: '../../../common/schemas/SearchParams.yml#/searchParamsObject'
$ref: './QueryParameters.yml#/fallbackParams'
required:
- model

Expand Down
2 changes: 1 addition & 1 deletion templates/dart/tests/param_object.mustache
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{{objectName}}}(
{{#lambda.pascalcase}}{{{objectName}}}{{/lambda.pascalcase}}(
{{#value}}
{{> tests/request_param}}
{{/value}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {
AutomaticFacetFilter,
AutomaticFacetFilters,
BaseSearchParams,
BaseIndexSettings,
BaseSearchParamsWithoutQuery,
BaseSearchResponse,
BooleanString,
Expand Down Expand Up @@ -99,6 +100,7 @@ export {
AutomaticFacetFilter,
AutomaticFacetFilters,
BaseSearchParams,
BaseIndexSettings,
BaseSearchParamsWithoutQuery,
BaseSearchResponse,
BooleanString,
Expand Down

0 comments on commit 1a73994

Please sign in to comment.