Home > Backend Development > PHP Tutorial > Introduction to using coreseek and paginating it_PHP tutorial

Introduction to using coreseek and paginating it_PHP tutorial

WBOY
Release: 2016-07-21 15:04:34
Original
890 people have browsed it

It’s really hard to find the total amount of data when using coreseek for paging. I thought he would give me a method (function) or something to get it, but it turned out not to be the case.
First you need to know:
num_matches:
The number of results currently returned, <= limit setting value.
max_matches: The maximum number of results returned, the default is 1000, the user can only see a maximum of 1000 search results. This is set in csft_mysql.conf.
total_found: Total number of results. The total number of documents in the index that meet the query criteria. This is included in the array in the returned results of your query. Of course, the premise is that you must set it before the query: $this->sc->SetArrayResult(true);
total: The maximum number of results returned, the value depends on the max_matches value and the total_found value. If the number of total_found exceeds max_matches, then total = max_matches, otherwise, total = total_found. This is also included in the array in the returned results of your query. Of course, the premise is that you must set it before the query: $this->sc->SetArrayResult(true);
In this way, you can do paging after understanding these attributes.

We should use the total in the return value to do the total paging data. Although this does not represent the real return value (when the return value is greater than max_matches, which is 1000, if the real return value is 2500, you can only get 1000).
The code is:

Copy the codeThe 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 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 number of paging we want Data.
Other subsequent paging is based on styles and data structures, which cannot be the same, and paging is also a basic thing, so I won’t go into the details of paging here. I will only discuss the value of this total data here. Because many people take the value of count($res['matches']), but this is the return result after paging, and you can only get 10, or 20 or other values. Haha, that would be funny.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327775.htmlTechArticlecoreseek It’s really hard to find the total amount of data when doing paging. I thought he would give me a method (function) or something to get it, but it turned out not to be the case. First you need to understand: num_matches: currently returned...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template