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

Add sort order for facet values for Meilisearch v1.3 #1536

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,13 @@ export type TypoTolerance = {
}
} | null

export type FacetOrder = 'alpha' | 'count'

export type Faceting = {
maxValuesPerFacet?: number | null
sortFacetValuesBy?: Record<string, FacetOrder> | null
}

export type PaginationSettings = {
maxTotalHits?: number | null
}
Expand Down
75 changes: 75 additions & 0 deletions tests/__snapshots__/faceting.test.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test on faceting Admin key: Get default faceting object 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Reset faceting 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting at null 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Admin key: Update faceting settings 1`] = `
Object {
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"*": "alpha",
"test": "count",
},
}
`;

exports[`Test on faceting Master key: Get default faceting object 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Reset faceting 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting at null 1`] = `
Object {
"maxValuesPerFacet": 100,
"sortFacetValuesBy": Object {
"*": "alpha",
},
}
`;

exports[`Test on faceting Master key: Update faceting settings 1`] = `
Object {
"maxValuesPerFacet": 12,
"sortFacetValuesBy": Object {
"*": "alpha",
"test": "count",
},
}
`;
Loading