Answer the question
In order to leave comments, you need to log in
Sphinx. How to give weight to some words in a query?
I display related posts and make it a query
SELECT id, WEIGHT() as relevance FROM posts
WHERE MATCH('(@content world|peace|leo)')
ORDER BY relevance DESC
OPTION ranker = 'bm25'
SELECT id, WEIGHT() as relevance FROM posts
WHERE MATCH('(@content world|peace|leo) (@content_2 photography)')
ORDER BY relevance DESC
OPTION ranker = 'bm25', field_weights=(content=10,content_2=5)
Answer the question
In order to leave comments, you need to log in
SELECT id, WEIGHT() as relevance FROM posts
WHERE MATCH('(@content world|peace|leo^10) (@content photography^5)')
ORDER BY relevance DESC
OPTION ranker = 'bm25'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question