-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat(atomic, headless): add support for sort criteria alphanumericNatural #4493
base: master
Are you sure you want to change the base?
Conversation
Pull Request ReportPR Title✅ Title follows the conventional commit spec. Live demo linksBundle Size
SSR Progress
Detailed logssearch : buildInteractiveResultsearch : buildInteractiveInstantResult search : buildInteractiveRecentResult search : buildInteractiveCitation search : buildGeneratedAnswer recommendation : missing SSR support case-assist : missing SSR support insight : missing SSR support commerce : missing SSR support |
@@ -174,7 +174,7 @@ export class AtomicFacet implements InitializableComponent { | |||
@Prop({reflect: true}) public withSearch = true; | |||
/** | |||
* The sort criterion to apply to the returned facet values. | |||
* Possible values are 'score', 'alphanumeric', 'alphanumericDescending', 'occurrences', and 'automatic'. | |||
* Possible values are 'score', 'alphanumeric', 'alphanumericDescending', 'occurrences', alphanumericNatural', 'alphanumericNaturalDescending' and 'automatic'. | |||
*/ | |||
@Prop({reflect: true}) public sortCriteria: FacetSortCriterion = 'automatic'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The interface FacetSortCriterion
does not contain alphanumericNatural' & alphanumericNaturalDescending.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR adds them!
import {FacetSortCriterion} from '@coveo/headless'; | ||
import {orderBy} from 'natural-orderby'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think adding a dependency is necessary for tests. Is there other ways you can test this ? Or at least put it in devDependencies ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep def should be in dev deps. Extracting the sorting logic from natural-orderby would be too much work.
I tried with natural-compare-lite and javascript-natural-sort, which are already in our deps, but they don't sort in the same way as the index...
This PR adds support for the alphanumericNatural and alphanumericNaturalDescending sort criteria for facets in headless and atomic.
https://coveord.atlassian.net/browse/KIT-3528