How would i prioritize a match within matching res...
# community-help
h
How would i prioritize a match within matching results with the same score? I've got a products collection with a "keywords" String[] field. Lets say i've got 20 products that have the keyword "milk" but i want to be able to weight some products more than others. My plan was to add a keyword multiple times to the string arra to make it more important, like so: ["milk","milk","milk"]. Byt Typesense seem to only score that as a single match. It gets the same score as a product with only one "milk" keyword.
Copy code
{
  "name": "products",
  "fields": [
    {"name": "keywords", "type": "string[]" },
  ]
}
Copy code
{"id": "one", "keywords": ["milk"]}
{"id": "two", "keywords": ["milk", "milk"]}
{"id": "three", "keywords": ["milk", "milk", "milk"]}
Copy code
{
  "collection": "products",
  "q": "milk",
  "query_by": "keywords"
}
i know i can curate the search, but i was hoping for something easier to manage for my content managers
a
You can create a weight field and sort by this field. It could be, for example, a "priority" numerical field.
👍 1