This is for those people who have tried out Geeklog 1.6.0 beta 1 and are having issues with the new search engine. Many of these issues stem from variations in the search API, some work was done to provide backwards compatibility but there is only so much I can do. The old API just did not return the data that was needed. So here I have provided some patches for some of the main plugins. Hopefully this will give you a better user experience.
DISCLAIMER
Before you start make sure to take a backup of the
/plugins/<plugin_name>/functions.inc file. I cannot be held responsible for any damage that's done to your websites. I am simply providing this information to help people out, its up to you whether or not you want to try it. I have not used any of these plugins before so this code has not been fully tested. The code was built upon the plugins versions that were found on this site (whether these are the latest...I don't know).
But it
*should* work...
To apply these patches open up the relevant
/plugins/<plugin_name>/functions.inc file and find the
plugin_dopluginsearch_<plugin_name> function. Then simply replace the entire function with the relevant one below.
FAQ Manager 0.8.1
Text Formatted Code
/**
* This searches for faqs matching the user query and returns an object
* back to search.php where it will be formated and printed.
*
* @param string $query Keywords user is looking for
* @param date $datestart Start date to get results for (not used)
* @param date $dateend End date to get results for (not used)
* @param string $topic The topic they were searching in (not used)
* @param string $type Type of items they are searching, or 'all' (deprecated)
* @param int $author Get all results by this author (not used)
* @param string $keyType search key type: 'all', 'phrase', 'any'
* @param int $page page number of current search (deprecated)
* @param int $perpage number of results per page (deprecated)
* @return object search result object
*
*/
function plugin_dopluginsearch_faqman($query, $datestart, $dateend, $topic, $type, $author, $keyType, $page, $perpage)
{
global $_TABLES, $LANG_FAQ;
// Make sure the query is SQL safe
$query = trim(addslashes($query));
$sql = "SELECT topicID AS id, question AS title, answer AS description, ";
$sql .= "CONCAT('/faqman/index.php?op=view&t=', topicID) AS url ";
$sql .= "FROM {$_TABLES['faq_topics']} topic LEFT JOIN {$_TABLES['faq_categories']} category ON topic.catID = category.catID ";
$sql .= "WHERE 1=1 ";
$search = new SearchCriteria('faqman', $LANG_FAQ['searchlabel']);
$columns = array('title' => 'question', 'answer', 'keywords');
list($sql,$ftsql) = $search->buildSearchSQL($keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
$search->setRank(3);
return $search;
}
File Management 1.5.3
Text Formatted Code
/**
* This searches for files matching the user query and returns an object
* back to search.php where it will be formated and printed.
*
* @param string $query Keywords user is looking for
* @param date $datestart Start date to get results for
* @param date $dateend End date to get results for
* @param string $topic The topic they were searching in
* @param string $type Type of items they are searching, or 'all' (deprecated)
* @param int $author Get all results by this author
* @param string $keyType search key type: 'all', 'phrase', 'any'
* @param int $page page number of current search (deprecated)
* @param int $perpage number of results per page (deprecated)
* @return object search result object
*
*/
function plugin_dopluginsearch_filemgmt($query, $datestart, $dateend, $topic, $type, $author, $keyType, $page, $perpage)
{
global $_FM_TABLES, $LANG_FILEMGMT;
// Make sure the query is SQL safe
$query = trim(addslashes($query));
$sql = "SELECT a.lid AS id, a.submitter AS uid, a.title, a.hits, a.date, c.description, ";
$sql .= "CONCAT('/filemgmt/index.php?id=', a.lid) AS url ";
$sql .= "FROM {$_FM_TABLES['filemgmt_filedetail']} a ";
$sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_cat']} b ON b.cid=a.cid ";
$sql .= "LEFT JOIN {$_FM_TABLES['filemgmt_filedesc']} c ON c.lid=a.lid ";
$sql .= filemgmt_buildAccessSql('WHERE') . " AND a.status > 0 ";
if (!empty($datestart) && !empty($dateend))
{
$delim = substr($datestart, 4, 1);
if (!empty($delim))
{
$DS = explode($delim, $datestart);
$DE = explode($delim, $dateend);
$startdate = mktime(0,0,0,$DS[1],$DS[2],$DS[0]);
$enddate = mktime(23,59,59,$DE[1],$DE[2],$DE[0]);
$sql .= "AND (date BETWEEN '$startdate' AND '$enddate') ";
}
}
if (!empty($author)) {
$sql .= "AND (submitter = '$author') ";
}
$search = new SearchCriteria('filemgmt', $LANG_FILEMGMT['searchlabel']);
$columns = array('title' => 'a.title', 'c.description');
list($sql,$ftsql) = $search->buildSearchSQL($keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
$search->setRank(3);
return $search;
}
Forum 2.7.2
Text Formatted Code
/**
* This searches for forum posts matching the user query and returns an object
* back to search.php where it will be formated and printed.
*
* @param string $query Keywords user is looking for
* @param date $datestart Start date to get results for
* @param date $dateend End date to get results for
* @param string $topic The topic they were searching in
* @param string $type Type of items they are searching, or 'all' (deprecated)
* @param int $author Get all results by this author
* @param string $keyType search key type: 'all', 'phrase', 'any'
* @param int $page page number of current search (deprecated)
* @param int $perpage number of results per page (deprecated)
* @return object search result object
*
*/
function plugin_dopluginsearch_forum($query, $datestart, $dateend, $topic, $type, $author, $keyType, $page, $perpage)
{
global $_TABLES, $LANG_GF00;
// Make sure the query is SQL safe
$query = trim(addslashes($query));
$sql = "SELECT id, uid, date, subject AS title, comment AS description, views AS hits, ";
$sql .= "CONCAT('/forum/viewtopic.php?forum=', forum, '&showtopic=', id) AS url ";
$sql .= "FROM {$_TABLES['gf_topic']} WHERE 1=1 ";
if (!empty($datestart) && !empty($dateend))
{
$delim = substr($datestart, 4, 1);
if (!empty($delim))
{
$DS = explode($delim, $datestart);
$DE = explode($delim, $dateend);
$startdate = mktime(0,0,0,$DS[1],$DS[2],$DS[0]);
$enddate = mktime(23,59,59,$DE[1],$DE[2],$DE[0]);
$sql .= "AND (date BETWEEN '$startdate' AND '$enddate') ";
}
}
if (!empty ($author)) {
$sql .= "AND (uid = '$author') ";
}
$search = new SearchCriteria('forum', $LANG_GF00['searchlabel']);
$columns = array('title' => 'subject', 'comment');
list($sql,$ftsql) = $search->buildSearchSQL($keyType, $query, $columns, $sql);
$search->setSQL($sql);
$search->setFTSQL($ftsql);
$search->setRank(3);
return $search;
}