PHP Application Sphinx Interface to sort

Source: Internet
Author: User

Sort mode
Search results can be sorted using the following pattern:

Sph_sort_relevance mode, sorted in descending order of relevance (best match in front)

Sph_sort_attr_desc mode, arranged in descending order of attributes (the higher the value of the property, the greater the number of rows in front)

SPH_SORT_ATTR_ASC mode, arranged in ascending order of attributes (the smaller the attribute value, the more it is in front)

Sph_sort_time_segments mode, descending by time period (last hour/day/week/month), and then by relevance

sph_sort_extended mode, which combines columns in ascending or descending order in a SQL-like way.

sph_sort_expr mode, sorted by an arithmetic expression

Use attributes to sort//to Fromid in reverse order, note that when you use Setsortmode again the previous sort $sphinx->setsortmode ("Sph_sort_attr_desc", ' Fromid ') will be overwritten;// If you want to use multiple field sorting can use sph_sort_extended mode//@id is the Sphinx built-in keyword, here refers to Emailid, as for why Emailid, think about $sphinx->setsortmode ("SPH _sort_attr_desc ", ' Fromid ASC, toid desc, @id desc ');//Perform search $result = $sphinx->query (' keywords ', ' * ');

PHP Application Sphinx Interface to sort

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.