Repository navigation
Add ability to define search synonyms - #51
Conversation
Update for per component display logic
Co-authored-by: Philo Hermans <me@philohermans.com>
Add ability to have search synonyms
PhiloNL
left a comment
There was a problem hiding this comment.
Thanks for the PR looks like a great addition! 🙌
Just one question about one of the Fuse instances, other than that everything seems good to go. 😄
| this.commandSearch = new Fuse(this.commands, {threshold: 0.3, keys: ['name', 'description']}); | ||
| this.dependencySearch = new Fuse([], {threshold: 0.3, keys: ['name', 'description']}); | ||
| this.commandSearch = new Fuse(this.commands, {threshold: 0.3, keys: ['name', 'description', 'synonyms']}); | ||
| this.dependencySearch = new Fuse([], {threshold: 0.3, keys: ['name', 'description', 'synonyms']}); |
There was a problem hiding this comment.
I don't think the synonyms apply for the dependencies or did you ran into issues if you did not apply the synonyms properties for both Fuse instances?
There was a problem hiding this comment.
@PhiloNL I wasn't quite sure if they needed to be added there are not. Now that I think about it, you're probably right that they don't need to be there. Let me just run a couple of tests and if everything checks out, I'll push an update.
|
@PhiloNL Pulled those out of the dependency search and updated the command stub. Should be all set! |
|
Thanks @dvanscott 🙌 |
I found myself wanting to provide some additional search terms to find one of my commands. My initial idea was to start putting those words in the description, but it ended up creating a really bad user experience with random words in the description that's displayed in the search results.
This PR adds the ability to add additional search terms (called synonyms here, but open to other ideas) to any command. This provides a simple way for developers to give their users additional terms to find commands.
For context, here's an example of how (and why) you might want to use synonyms for a command:
This would allow for a user to type
credit cardand be show the View Billing Settings command in the search results.