Home  >  Article  >  CMS Tutorial  >  What should I do if phpcms cannot find the content?

What should I do if phpcms cannot find the content?

藏色散人
藏色散人Original
2020-02-03 13:52:422547browse

What should I do if phpcms cannot find the content?

What should I do if phpcms cannot find the content? Phpcms v9 search results are incomplete and the content cannot be searched and the search result sorting problem

There is a problem with the Phpcms V9 result search used in the website backend. I have found the information and organized it as follows:

First Steps:

phpcms v9 search results are incomplete and the content cannot be found Solution:

Open phpcms\modules\search\index.php

Find

if(!empty($segment_q)) {
 
$sql = “`siteid`= ‘$siteid’ AND `typeid` = ‘$typeid’ $sql_time AND MATCH (`data`) AGAINST (‘$segment_q’ IN BOOLEAN MODE)”;
 
} else {
 
$sql = “`siteid`= ‘$siteid’ AND `typeid` = ‘$typeid’ $sql_time AND `data` like ‘%$q%'”;
}

Modify to

if(!empty($segment_q)) {
$sql = “`siteid`= ‘$siteid’ AND `typeid` = ‘$typeid’ $sql_time AND `data` like ‘%$q%'”;
 
} else {
 
$sql = “`siteid`= ‘$siteid’ AND `typeid` = ‘$typeid’ $sql_time AND `data` like ‘%$q%'”;
}

The result is that you no longer use word segmentation for keyword searches, but directly use the keywords you entered to search.

Second step:

Search results are sorted in descending order of time

Modified page: \phpcms\modules\search\index.php Only modify one line!

Search:

$data = $this->content_db->select($where, ‘*’);

Replace with:

$data = $this->content_db->select($where, ‘*’,”,’id desc’);

This way the search content can be sorted in descending order by time.

PHP Chinese website, a large number of free PHPCMS tutorials, welcome to learn online!

The above is the detailed content of What should I do if phpcms cannot find the content?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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