From 65254f5db47ce3fb8ce1bf9c4bbda2cd6f977cf8 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 11 Dec 2020 09:48:34 +0300 Subject: - move sphinx plugin to a separate repo - regenerate config checks without sphinx-related variables --- plugins/search_sphinx/init.php | 65 ------------------------------------------ 1 file changed, 65 deletions(-) delete mode 100644 plugins/search_sphinx/init.php (limited to 'plugins/search_sphinx/init.php') diff --git a/plugins/search_sphinx/init.php b/plugins/search_sphinx/init.php deleted file mode 100644 index 95b7ad676..000000000 --- a/plugins/search_sphinx/init.php +++ /dev/null @@ -1,65 +0,0 @@ -add_hook($host::HOOK_SEARCH, $this); - - // idk if that would work but checking for the class being loaded is somehow not enough - if (class_exists("SphinxClient") && !defined('SEARCHD_COMMAND_SEARCH')) { - user_error("Your PHP has a separate systemwide Sphinx client installed which conflicts with the client library used by tt-rss. Either remove the system library or disable Sphinx support."); - } - - require_once __DIR__ . "/sphinxapi.php"; - } - - function hook_search($search) { - $offset = 0; - $limit = 500; - - $sphinxClient = new SphinxClient(); - - $sphinxpair = explode(":", SPHINX_SERVER, 2); - - $sphinxClient->SetServer($sphinxpair[0], (int)$sphinxpair[1]); - $sphinxClient->SetConnectTimeout(1); - - $sphinxClient->SetFieldWeights(array('title' => 70, 'content' => 30, - 'feed_title' => 20)); - - $sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED2); - $sphinxClient->SetRankingMode(SPH_RANK_PROXIMITY_BM25); - $sphinxClient->SetLimits($offset, $limit, 1000); - $sphinxClient->SetArrayResult(false); - $sphinxClient->SetFilter('owner_uid', array($_SESSION['uid'])); - - $result = $sphinxClient->Query($search, SPHINX_INDEX); - - $ids = array(); - - if (is_array($result['matches'])) { - foreach (array_keys($result['matches']) as $int_id) { - $ref_id = $result['matches'][$int_id]['attrs']['ref_id']; - array_push($ids, $ref_id); - } - } - - $ids = join(",", $ids); - - if ($ids) - return array("ref_id IN ($ids)", array()); - else - return array("ref_id = -1", array()); - } - - function api_version() { - return 2; - } -} -- cgit v1.2.3-54-g00ecf