PHP code example of gpupo / search
1. Go to this page and download the library: Download gpupo/search library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gpupo / search example snippets
use Gpupo\Search\Search;
use Gpupo\Search\Query\Keywords;
use Gpupo\Search\Query\Query;
$keywords = new Keywords;
$keywords->addKeyword('magic');
$keywords->addKeyword('unicorn');
$query = new Query($keywords);
$query->setIndex('fantasyIndex');
//Configure Sphinx Server Parameters:
SphinxService::getInstance()->setParameters(array(
'host' => 'foo.bar.com', //default value is localhost
));
$results = Search::getInstance()->findByQuery($query);
$results->getTotal(); // Itens found
bash
RELEASE='21';
lynx --dump --source https://sphinxsearch.googlecode.com/svn/branches/rel${RELEASE}/api/sphinxapi.php > src//Sphinx/sphinxapi.php