v2-hub icon indicating copy to clipboard operation
v2-hub copied to clipboard

FR: Weighted fields with local search driver

Open medvesekg opened this issue 6 years ago • 1 comments
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

medvesekg avatar Oct 03 '19 12:10 medvesekg

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.

simonhamp avatar Oct 03 '19 13:10 simonhamp