php - How to search by URL using Sphinx? -
i have index in sphinx. 1 of field in index url. , contains example next values:
(1) http://u24.ru/news/38417/v-centre-chelyabinska-muzhchina-popytalsya-pereplyt-reku?rss (2) https://meduza.io/feature/2017/07/10/islamskoe-gosudarstvo-vybili-iz-mosula-chto-budet-dalshe (3) https://stolica-s.su/sport/athletics/89078
how try search url (part of code):
$query = $this->manager->makequery() ->select(['id']) ->from(['content']); $url = str_replace( ['=', '&', '?', '-', '%'], [' ', ' ', ' ', ' ', ' '], 'http://www.ruscur.ru/themes/0/00/70/7020.shtml?news/0/10/43/104359' ); $url = $query->escapematch($url); $query->match('url', $url); var_dump($query->execute()->fetchallassoc()); // empty
is way search sphinx without using fulltext searching?
you can make hash of url , store it, compare hash:
$query = $this->manager->makequery() ->select(['id']) ->from(['content']) ->where('hash', '=', hasher::hash($url));
hint query builder: http://foolcode.github.io/sphinxql-query-builder/
Comments
Post a Comment