Answer the question
In order to leave comments, you need to log in
How to do a simple sort by id in Sphinx?
The essence of the question is simple. There is a big table in mysql for 10 million records. The table is constantly growing.
On the main page, you need to display the latest posts with pagelinks from 0 to 10000.
Doing it through mysql through limits (limit 0.50) is long and stupid. Therefore, I think sphinx should help with this.
I create an index (address) based on a simple table of 2 fields: id and address
The table is filled with keywords from addresses.
Address example: 702 St Bentonville, United States
In general, I need an index for both pagelinks and for searching by the address field.
The code:
include('sphinxapi.php');
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode(SPH_MATCH_ANY);
$cl->SetSortMode(SPH_SORT_EXTENDED, '@id desc');
$cl->SetLimits(0, 50);
// ?
include('sphinxapi.php');
$cl = new SphinxClient();
$cl->SetServer( "localhost", 9312 );
$cl->SetMatchMode(SPH_MATCH_EXTENDED2);
$cl->SetSortMode(SPH_SORT_EXTENDED, '@id desc');
$cl->SetLimits(0, 50);
$cl->Query("", "address"); // пустое поле, т.к. просто постраничный вывод
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question