Reputation: 1065
I have query to sphinx index like this:
SELECT author_id
FROM books
WHERE MATCH(%s)
and I want to set specific weight to columns. For example column book_title
is much more important than book_description
and it is more important than book_content
.
For example I would set:
book_title
weight: 10book_description
weight: 5book_content
weight: 1How can I do it in sql query?
Upvotes: 2
Views: 2360
Reputation: 6654
Please see in the manual that you can pass field_weights
on a per-query basis with the OPTION
keyword. In your case you might want to use
SELECT * FROM books WHERE MATCH(%s)
OPTION field_weights=(book_content=1, book_description=5, book_title=10)
Upvotes: 4