v2-hub
v2-hub copied to clipboard
FR: Weighted fields with local search driver
trafficstars
Describe the solution you'd like I would like to be able to define custom weights for different searchable fields when using the local search driver. The use case would be that I would want to have items that have the search term in the title to appear near the top of the search results.
Additional context I would like to to this in search.yaml
driver: local
searchable:
- title
- content
weights:
- title: 50
- content: 10
Why not just...?
searchable:
-
field: title
weight: 50
-
field: content
weight: 10
- author
This keeps the shorthand syntax concise and follows the pattern used elsewhere (e.g. routes.yaml) that allows you to expand out the array when necessary.