Introduction to using coreseek and paging it _ PHP Tutorial

Source: Internet
Author: User
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...

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.