sphinx-searchHow to order search results by relevance in SphinxSearch?
SphinxSearch provides a way to order search results by relevance. This can be done by using the weight()
function.
SELECT * FROM index WHERE MATCH('query') ORDER BY weight() DESC;
The code above will return the search results ordered by relevance. The RANK()
function will assign a relevance score to each result based on the relevance of the query to the result.
SELECT *
: This will select all columns from the index.MATCH('query')
: This will search the index for the given query.ORDER BY weight() DESC
: This will order the results by relevance in descending order.
Helpful links
More of Sphinx Search
- How to specify stop words in SphinxSearch?
- How to use the MySQL protocol in SphinxSearch?
- How to get the version of SphinxSearch?
- How to use SphinxSearch with PHP?
- How to use regexp_filter in SphinxSearch?
- How to use query_log_format in SphinxSearch?
- How to configure max_children in SphinxSearch?
- How to use forward slash in SphinxSearch?
- How to use sql_attr_float in SphinxSearch?
See more codes...