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

Expand docs for Search Plugin #10548

Open
m-shum opened this issue Jan 13, 2025 · 1 comment
Open

Expand docs for Search Plugin #10548

m-shum opened this issue Jan 13, 2025 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@m-shum
Copy link

m-shum commented Jan 13, 2025

Documentation Issue

Search Plugin documentation needs additional examples & additional information on priority and how to manage it. Missing documentation of how the plugin is integrated with collections.

Additional Details

There is currently no documentation on how this plugin interacts with a frontend or how to write queries for the search endpoint.
There is also no documentation on priority – only a brief mention of defaultPriorities. The documentation states This plugin automatically adds a priority field to the search collection that can be used as the ?sort= parameter in your queries. however there's no explanation of how this parameter should be defined or what value the priority field should have. Does it prfioritize a whole collection or certain fields? More information needed.

Example repo link would be especially beneficial.

@m-shum m-shum added the documentation Improvements or additions to documentation label Jan 13, 2025
@akhrarovsaid
Copy link
Contributor

akhrarovsaid commented Jan 13, 2025

Hey @m-shum,

In terms of example usage have a look at how the website template uses the search plugin. I've linked you to the directory where the actual pages perform the query via the local api to get relevant results. All plugin-search does is add a collection, along with some helpful hooks, to your existing config. By default it has a slug of 'search' but this can be changed. You can interact with this collection using existing API's like you would with your own collections.

As for priorities, I agree that it could be better explained. Hopefully I can clear up any confusion for you here. The plugin automatically adds a field named priority of type number. This field can be used to sort your documents by specifying a value to priority and then sorting against it as you could with any other field. What the defaultPriorities property does is simply give you an option to specify how it should prioritize documents at the collection or document-level. What priorities they should get is completely up to you, and as I mentioned above, can be sorted to get more relevant data for your use-case.

The defaultPriorities property accepts a number to be used as a collection-level static priority, or can accept a callback function which passes the relevant doc to you so that you can better decide how to assign a priority. Say, for example, if your docs had a Checkbox field that could represent a document with high priority over ordinary documents from the same collection, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants