Skip to content

Commit 1e847f4

Browse files
authored
fix(specs): move customRanking and keepDiacriticsOnCharacters to indexSettings [skip-bc] (#4324)
## 🧭 What and Why 🎟 JIRA Ticket: [DI-3373](https://algolia.atlassian.net/browse/DI-3373) fixes #4322 [DI-3373]: https://algolia.atlassian.net/browse/DI-3373?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent df54086 commit 1e847f4

File tree

10 files changed

+55
-60
lines changed

10 files changed

+55
-60
lines changed

clients/algoliasearch-client-kotlin/client/src/commonMain/kotlin/com/algolia/client/extensions/SearchForHits.kt

-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public fun SearchForHits.Companion.from(
4949
enableABTest = searchParamsObject.enableABTest,
5050
attributesToRetrieve = searchParamsObject.attributesToRetrieve,
5151
ranking = searchParamsObject.ranking,
52-
customRanking = searchParamsObject.customRanking,
5352
relevancyStrictness = searchParamsObject.relevancyStrictness,
5453
attributesToHighlight = searchParamsObject.attributesToHighlight,
5554
attributesToSnippet = searchParamsObject.attributesToSnippet,
@@ -65,7 +64,6 @@ public fun SearchForHits.Companion.from(
6564
disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes,
6665
ignorePlurals = searchParamsObject.ignorePlurals,
6766
removeStopWords = searchParamsObject.removeStopWords,
68-
keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters,
6967
queryLanguages = searchParamsObject.queryLanguages,
7068
decompoundQuery = searchParamsObject.decompoundQuery,
7169
enableRules = searchParamsObject.enableRules,

clients/algoliasearch-client-swift/Sources/Search/Extra/SearchQueryExtension.swift

-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ public extension SearchForHits {
5252
self.enableABTest = searchParamsObject.enableABTest
5353
self.attributesToRetrieve = searchParamsObject.attributesToRetrieve
5454
self.ranking = searchParamsObject.ranking
55-
self.customRanking = searchParamsObject.customRanking
5655
self.relevancyStrictness = searchParamsObject.relevancyStrictness
5756
self.attributesToHighlight = searchParamsObject.attributesToHighlight
5857
self.attributesToSnippet = searchParamsObject.attributesToSnippet
@@ -68,7 +67,6 @@ public extension SearchForHits {
6867
self.disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes
6968
self.ignorePlurals = searchParamsObject.ignorePlurals
7069
self.removeStopWords = searchParamsObject.removeStopWords
71-
self.keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters
7270
self.queryLanguages = searchParamsObject.queryLanguages
7371
self.decompoundQuery = searchParamsObject.decompoundQuery
7472
self.enableRules = searchParamsObject.enableRules
@@ -139,7 +137,6 @@ public extension SearchForFacets {
139137
self.enableABTest = searchParamsObject.enableABTest
140138
self.attributesToRetrieve = searchParamsObject.attributesToRetrieve
141139
self.ranking = searchParamsObject.ranking
142-
self.customRanking = searchParamsObject.customRanking
143140
self.relevancyStrictness = searchParamsObject.relevancyStrictness
144141
self.attributesToHighlight = searchParamsObject.attributesToHighlight
145142
self.attributesToSnippet = searchParamsObject.attributesToSnippet
@@ -155,7 +152,6 @@ public extension SearchForFacets {
155152
self.disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes
156153
self.ignorePlurals = searchParamsObject.ignorePlurals
157154
self.removeStopWords = searchParamsObject.removeStopWords
158-
self.keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters
159155
self.queryLanguages = searchParamsObject.queryLanguages
160156
self.decompoundQuery = searchParamsObject.decompoundQuery
161157
self.enableRules = searchParamsObject.enableRules

oxlintrc.json

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
{
22
"env": {
33
"es6": true
4+
},
5+
"rules": {
6+
"@typescript-eslint/consistent-type-imports": "error"
47
}
58
}

scripts/ci/codegen/__tests__/codegen.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { describe, expect, it, vi } from 'vitest';
33
import { pushGeneratedCode } from '../pushGeneratedCode.ts';
44

55
vi.mock('../../../common.ts', async (importOriginal) => {
6+
// eslint-disable-next-line
67
const mod = await importOriginal<typeof import('../../../common.ts')>();
78
return {
89
...mod,

scripts/ci/codegen/pushToRepository.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ import {
1515
toAbsolutePath,
1616
} from '../../common.ts';
1717
import { getNbGitDiff } from '../utils.ts';
18-
import { GuidesToPush, pushToRepositoryConfiguration, RepositoryConfiguration, SpecsToPush } from './types.ts';
18+
import type { GuidesToPush, RepositoryConfiguration, SpecsToPush } from './types.ts';
19+
import { pushToRepositoryConfiguration } from './types.ts';
1920

2021
import { getClientsConfigField } from '../../config.ts';
2122
import { commitStartRelease } from './text.ts';

scripts/cts/testServer/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ export async function setupServer(name: string, port: number, addRoutes: (app: E
6161
addRoutes(app);
6262

6363
// 404 handler
64-
app.use((req, res) => {
64+
app.use((req, _) => {
6565
console.error(`[PORT ${port}] endpoint not implemented for`, req.method, req.url);
6666
expect.fail('endpoint not implemented');
6767
});
6868

6969
// catch all error handler
70-
app.use((err, _req, res, _) => {
70+
app.use((err, _req, _res, _) => {
7171
console.error(err.message);
7272
expect.fail(err.message);
7373
});

scripts/release/__tests__/createReleasePR.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const buildTestCommit = (
3030

3131
// Mock `getOctokit` to bypass the API call and credential requirements
3232
vi.mock('../../common.ts', async (importOriginal) => {
33+
// eslint-disable-next-line
3334
const mod = await importOriginal<typeof import('../../common.ts')>();
3435
return {
3536
...mod,
@@ -48,6 +49,7 @@ vi.mock('../../common.ts', async (importOriginal) => {
4849
});
4950

5051
vi.mock('../../ci/utils.ts', async (importOriginal) => {
52+
// eslint-disable-next-line
5153
const mod = await importOriginal<typeof import('../../ci/utils.ts')>();
5254
return {
5355
...mod,
@@ -56,6 +58,7 @@ vi.mock('../../ci/utils.ts', async (importOriginal) => {
5658
});
5759

5860
vi.mock('../common.ts', async (importOriginal) => {
61+
// eslint-disable-next-line
5962
const mod = await importOriginal<typeof import('../common.ts')>();
6063
const getFileChangesMockFn = vi.fn();
6164

@@ -68,6 +71,7 @@ vi.mock('../common.ts', async (importOriginal) => {
6871
});
6972

7073
vi.mock('../../config.ts', async (importOriginal) => {
74+
// eslint-disable-next-line
7175
const mod = await importOriginal<typeof import('../../config.ts')>();
7276
return {
7377
...mod,

scripts/specs/__tests__/snippets.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest';
22

33
import { parseCodeSamples } from '../snippets.ts';
4-
import { CodeSamples } from '../types.ts';
4+
import type { CodeSamples } from '../types.ts';
55

66
describe('init', () => {
77
it('parses a multi line import', () => {

specs/common/schemas/IndexSettings.yml

+42-42
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,48 @@ baseIndexSettings:
285285
type: string
286286
maxFacetHits:
287287
$ref: '#/maxFacetHits'
288+
keepDiacriticsOnCharacters:
289+
type: string
290+
example: øé
291+
description: |
292+
Characters for which diacritics should be preserved.
293+
294+
By default, Algolia removes diacritics from letters.
295+
For example, `é` becomes `e`. If this causes issues in your search,
296+
you can specify characters that should keep their diacritics.
297+
default: ''
298+
x-categories:
299+
- Languages
300+
customRanking:
301+
type: array
302+
items:
303+
type: string
304+
example:
305+
- desc(popularity)
306+
- asc(price)
307+
description: |
308+
Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/).
309+
Attribute names are case-sensitive.
310+
311+
The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.
312+
313+
Records with missing values for your selected custom ranking attributes are always sorted last.
314+
Boolean attributes are sorted based on their alphabetical order.
315+
316+
**Modifiers**
317+
318+
- `asc("ATTRIBUTE")`.
319+
Sort the index by the values of an attribute, in ascending order.
320+
321+
- `desc("ATTRIBUTE")`.
322+
Sort the index by the values of an attribute, in descending order.
323+
324+
If you use two or more custom ranking attributes,
325+
[reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes,
326+
or the other attributes will never be applied.
327+
default: []
328+
x-categories:
329+
- Ranking
288330

289331
indexSettingsAsSearchParams:
290332
type: object
@@ -343,36 +385,6 @@ indexSettingsAsSearchParams:
343385
- custom
344386
x-categories:
345387
- Ranking
346-
customRanking:
347-
type: array
348-
items:
349-
type: string
350-
example:
351-
- desc(popularity)
352-
- asc(price)
353-
description: |
354-
Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/).
355-
Attribute names are case-sensitive.
356-
357-
The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.
358-
359-
Records with missing values for your selected custom ranking attributes are always sorted last.
360-
Boolean attributes are sorted based on their alphabetical order.
361-
362-
**Modifiers**
363-
364-
- `asc("ATTRIBUTE")`.
365-
Sort the index by the values of an attribute, in ascending order.
366-
367-
- `desc("ATTRIBUTE")`.
368-
Sort the index by the values of an attribute, in descending order.
369-
370-
If you use two or more custom ranking attributes,
371-
[reduce the precision](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/how-to/controlling-custom-ranking-metrics-precision/) of your first attributes,
372-
or the other attributes will never be applied.
373-
default: []
374-
x-categories:
375-
- Ranking
376388
relevancyStrictness:
377389
type: integer
378390
example: 90
@@ -497,18 +509,6 @@ indexSettingsAsSearchParams:
497509
$ref: '#/ignorePlurals'
498510
removeStopWords:
499511
$ref: '#/removeStopWords'
500-
keepDiacriticsOnCharacters:
501-
type: string
502-
example: øé
503-
description: |
504-
Characters for which diacritics should be preserved.
505-
506-
By default, Algolia removes diacritics from letters.
507-
For example, `é` becomes `e`. If this causes issues in your search,
508-
you can specify characters that should keep their diacritics.
509-
default: ''
510-
x-categories:
511-
- Languages
512512
queryLanguages:
513513
type: array
514514
items:

tests/CTS/requests/search/search.json

-8
Original file line numberDiff line numberDiff line change
@@ -824,9 +824,6 @@
824824
""
825825
],
826826
"clickAnalytics": true,
827-
"customRanking": [
828-
""
829-
],
830827
"decompoundQuery": true,
831828
"disableExactOnAttributes": [
832829
""
@@ -886,7 +883,6 @@
886883
2.0104
887884
]
888885
],
889-
"keepDiacriticsOnCharacters": "",
890886
"length": 1,
891887
"maxValuesPerFacet": 0,
892888
"minProximity": 1,
@@ -999,9 +995,6 @@
999995
""
1000996
],
1001997
"clickAnalytics": true,
1002-
"customRanking": [
1003-
""
1004-
],
1005998
"decompoundQuery": true,
1006999
"disableExactOnAttributes": [
10071000
""
@@ -1061,7 +1054,6 @@
10611054
2.0104
10621055
]
10631056
],
1064-
"keepDiacriticsOnCharacters": "",
10651057
"length": 1,
10661058
"maxValuesPerFacet": 0,
10671059
"minProximity": 1,

0 commit comments

Comments
 (0)