How can I prioritize search results containing a specific term in Sphinxsearch?

42 Views Asked by At

I am encountering an issue with the sorting of the search results in the following Sphinxsearch query (SphinxSE). Specifically, I would like to prioritize the results containing the term "asda" and display them at the top of the list, before showing the remaining titles.

Currently, the query sorts the results by the @weight attribute in descending order using the attr_desc:@weight parameter. Is there a way to modify this query to achieve the desired sorting behavior? Can I add weight for every search term?

Here is the original query for reference:

`query` = 'query=@title asda|coop|tesco; limit=15; mode=extended; sort=attr_desc:@weight; fieldweights=title,8,description,2;'

UPDATE

I've been using the query below, but I've noticed that it's not consistently producing the expected results. It's quite perplexing.

`query` = 'query=@title asda^8|coop^1.2|tesco^1.2; limit=15; mode=extended; sort=extended:@weight desc; fieldweights=title,8,description,2;'
0

There are 0 best solutions below