Introduction to using coreseek and paging it. When coreseek is used for paging, it is really hard to find the total amount of data. He thinks that he will give a method (function) or something to get, but the result is not. First, you need to know: num_matches: the total amount of data to be queried when the current returned coreseek is paging. He thinks that he will give a method (function) or something to get, but the result is not.
First, you need to understand:
Num_matches:Number of results returned currently, <= limit value.
Max_matches:The maximum number of returned results. The default value is 1000. you can view up to 1000 search results. This is set in csft_mysql.conf.
Total_found: total number of results. The total number of documents that meet the query conditions in the index. This is included in the array in the returned result of your query. Of course, the premise is that you must set before query: $ this-> SC-> SetArrayResult (true );
Total: the maximum number of returned results. The value depends on the max_matches value and total_found value. If the total_found number exceeds max_matches, total = max_matches; otherwise, total = total_found. This is also included in the array in the returned results of your query. The premise is that you must set $ this-> SC-> SetArrayResult (true) before query );
In this way, you can perform pagination after learning about these attributes.
We should use total in the returned value as the total paging data. Although this does not represent the actual return value (when the return value is greater than max_matches, that is, 1000, for example, 2500 is actually returned, but you can only get 1000 ).
The code is:
The code is as follows:
$ This-> SC-> SetServer ("127.0.0.1", 9312 );
$ This-> SC-> SetArrayResult (true );
$ This-> SC-> SetLimits ($ start, $ page );
// If you need to search for the content of a specified full-text field, you can use the extended matching mode:
$ This-> SC-> SetMatchMode (SPH_MATCH_ANY );
$ Res = $ this-> SC-> Query ($ where, "main ");
$ Count = $ res ['total'];
This $ count is the total data of the paging.
In other cases, paging is based on the style and data structure, which cannot be the same, and paging is also the basic thing. Therefore, we will not talk about paging details here. Here I will only discuss the value of this total data. Because many people take the value of count ($ res ['matches']), but this is the result returned after pagination. you can only get 10, 20, or other values. That's funny.
Http://www.bkjia.com/PHPjc/327775.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/327775.htmlTechArticlecoreseek when looking for the total amount of data is really difficult to find. He thinks that he will give a method (function) or something to get, but the result is not. First, you need to know: num_matches: The Current returned...