Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(specs): move customRanking and keepDiacriticsOnCharacters to indexSettings [skip-bc] #4324

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public fun SearchForHits.Companion.from(
enableABTest = searchParamsObject.enableABTest,
attributesToRetrieve = searchParamsObject.attributesToRetrieve,
ranking = searchParamsObject.ranking,
customRanking = searchParamsObject.customRanking,
relevancyStrictness = searchParamsObject.relevancyStrictness,
attributesToHighlight = searchParamsObject.attributesToHighlight,
attributesToSnippet = searchParamsObject.attributesToSnippet,
Expand All @@ -65,7 +64,6 @@ public fun SearchForHits.Companion.from(
disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes,
ignorePlurals = searchParamsObject.ignorePlurals,
removeStopWords = searchParamsObject.removeStopWords,
keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters,
queryLanguages = searchParamsObject.queryLanguages,
decompoundQuery = searchParamsObject.decompoundQuery,
enableRules = searchParamsObject.enableRules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public extension SearchForHits {
self.enableABTest = searchParamsObject.enableABTest
self.attributesToRetrieve = searchParamsObject.attributesToRetrieve
self.ranking = searchParamsObject.ranking
self.customRanking = searchParamsObject.customRanking
self.relevancyStrictness = searchParamsObject.relevancyStrictness
self.attributesToHighlight = searchParamsObject.attributesToHighlight
self.attributesToSnippet = searchParamsObject.attributesToSnippet
Expand All @@ -68,7 +67,6 @@ public extension SearchForHits {
self.disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes
self.ignorePlurals = searchParamsObject.ignorePlurals
self.removeStopWords = searchParamsObject.removeStopWords
self.keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters
self.queryLanguages = searchParamsObject.queryLanguages
self.decompoundQuery = searchParamsObject.decompoundQuery
self.enableRules = searchParamsObject.enableRules
Expand Down Expand Up @@ -139,7 +137,6 @@ public extension SearchForFacets {
self.enableABTest = searchParamsObject.enableABTest
self.attributesToRetrieve = searchParamsObject.attributesToRetrieve
self.ranking = searchParamsObject.ranking
self.customRanking = searchParamsObject.customRanking
self.relevancyStrictness = searchParamsObject.relevancyStrictness
self.attributesToHighlight = searchParamsObject.attributesToHighlight
self.attributesToSnippet = searchParamsObject.attributesToSnippet
Expand All @@ -155,7 +152,6 @@ public extension SearchForFacets {
self.disableTypoToleranceOnAttributes = searchParamsObject.disableTypoToleranceOnAttributes
self.ignorePlurals = searchParamsObject.ignorePlurals
self.removeStopWords = searchParamsObject.removeStopWords
self.keepDiacriticsOnCharacters = searchParamsObject.keepDiacriticsOnCharacters
self.queryLanguages = searchParamsObject.queryLanguages
self.decompoundQuery = searchParamsObject.decompoundQuery
self.enableRules = searchParamsObject.enableRules
Expand Down
3 changes: 3 additions & 0 deletions oxlintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"env": {
"es6": true
},
"rules": {
"@typescript-eslint/consistent-type-imports": "error"
}
}
1 change: 1 addition & 0 deletions scripts/ci/codegen/__tests__/codegen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { describe, expect, it, vi } from 'vitest';
import { pushGeneratedCode } from '../pushGeneratedCode.ts';

vi.mock('../../../common.ts', async (importOriginal) => {
// eslint-disable-next-line
const mod = await importOriginal<typeof import('../../../common.ts')>();
return {
...mod,
Expand Down
3 changes: 2 additions & 1 deletion scripts/ci/codegen/pushToRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
toAbsolutePath,
} from '../../common.ts';
import { getNbGitDiff } from '../utils.ts';
import { GuidesToPush, pushToRepositoryConfiguration, RepositoryConfiguration, SpecsToPush } from './types.ts';
import type { GuidesToPush, RepositoryConfiguration, SpecsToPush } from './types.ts';
import { pushToRepositoryConfiguration } from './types.ts';

import { getClientsConfigField } from '../../config.ts';
import { commitStartRelease } from './text.ts';
Expand Down
4 changes: 2 additions & 2 deletions scripts/cts/testServer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ export async function setupServer(name: string, port: number, addRoutes: (app: E
addRoutes(app);

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

// catch all error handler
app.use((err, _req, res, _) => {
app.use((err, _req, _res, _) => {
console.error(err.message);
expect.fail(err.message);
});
Expand Down
4 changes: 4 additions & 0 deletions scripts/release/__tests__/createReleasePR.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const buildTestCommit = (

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

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

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

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

vi.mock('../../config.ts', async (importOriginal) => {
// eslint-disable-next-line
const mod = await importOriginal<typeof import('../../config.ts')>();
return {
...mod,
Expand Down
2 changes: 1 addition & 1 deletion scripts/specs/__tests__/snippets.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';

import { parseCodeSamples } from '../snippets.ts';
import { CodeSamples } from '../types.ts';
import type { CodeSamples } from '../types.ts';

describe('init', () => {
it('parses a multi line import', () => {
Expand Down
84 changes: 42 additions & 42 deletions specs/common/schemas/IndexSettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,48 @@ baseIndexSettings:
type: string
maxFacetHits:
$ref: '#/maxFacetHits'
keepDiacriticsOnCharacters:
type: string
example: øé
description: |
Characters for which diacritics should be preserved.

By default, Algolia removes diacritics from letters.
For example, `é` becomes `e`. If this causes issues in your search,
you can specify characters that should keep their diacritics.
default: ''
x-categories:
- Languages
customRanking:
type: array
items:
type: string
example:
- desc(popularity)
- asc(price)
description: |
Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/).
Attribute names are case-sensitive.

The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.

Records with missing values for your selected custom ranking attributes are always sorted last.
Boolean attributes are sorted based on their alphabetical order.

**Modifiers**

- `asc("ATTRIBUTE")`.
Sort the index by the values of an attribute, in ascending order.

- `desc("ATTRIBUTE")`.
Sort the index by the values of an attribute, in descending order.

If you use two or more custom ranking attributes,
[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,
or the other attributes will never be applied.
default: []
x-categories:
- Ranking

indexSettingsAsSearchParams:
type: object
Expand Down Expand Up @@ -343,36 +385,6 @@ indexSettingsAsSearchParams:
- custom
x-categories:
- Ranking
customRanking:
type: array
items:
type: string
example:
- desc(popularity)
- asc(price)
description: |
Attributes to use as [custom ranking](https://www.algolia.com/doc/guides/managing-results/must-do/custom-ranking/).
Attribute names are case-sensitive.

The custom ranking attributes decide which items are shown first if the other ranking criteria are equal.

Records with missing values for your selected custom ranking attributes are always sorted last.
Boolean attributes are sorted based on their alphabetical order.

**Modifiers**

- `asc("ATTRIBUTE")`.
Sort the index by the values of an attribute, in ascending order.

- `desc("ATTRIBUTE")`.
Sort the index by the values of an attribute, in descending order.

If you use two or more custom ranking attributes,
[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,
or the other attributes will never be applied.
default: []
x-categories:
- Ranking
relevancyStrictness:
type: integer
example: 90
Expand Down Expand Up @@ -497,18 +509,6 @@ indexSettingsAsSearchParams:
$ref: '#/ignorePlurals'
removeStopWords:
$ref: '#/removeStopWords'
keepDiacriticsOnCharacters:
type: string
example: øé
description: |
Characters for which diacritics should be preserved.

By default, Algolia removes diacritics from letters.
For example, `é` becomes `e`. If this causes issues in your search,
you can specify characters that should keep their diacritics.
default: ''
x-categories:
- Languages
queryLanguages:
type: array
items:
Expand Down
8 changes: 0 additions & 8 deletions tests/CTS/requests/search/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -824,9 +824,6 @@
""
],
"clickAnalytics": true,
"customRanking": [
""
],
"decompoundQuery": true,
"disableExactOnAttributes": [
""
Expand Down Expand Up @@ -886,7 +883,6 @@
2.0104
]
],
"keepDiacriticsOnCharacters": "",
"length": 1,
"maxValuesPerFacet": 0,
"minProximity": 1,
Expand Down Expand Up @@ -999,9 +995,6 @@
""
],
"clickAnalytics": true,
"customRanking": [
""
],
"decompoundQuery": true,
"disableExactOnAttributes": [
""
Expand Down Expand Up @@ -1061,7 +1054,6 @@
2.0104
]
],
"keepDiacriticsOnCharacters": "",
"length": 1,
"maxValuesPerFacet": 0,
"minProximity": 1,
Expand Down
Loading