<?php /** * sphinxql测试产品搜索 */ namespace Xz; define("LIB", "/data/cap/gitwork/php/library"); define("COMPOSER", LIB . "/composer"); include_once "/data/cap/gitwork/php/library/SphinxQL/SphinxQL.php"; require_once LIB . "/composer/autoload_real.php"; \ComposerAutoloaderInit9d9ec52c7ca517098968508cff22c107::getLoader(); $sphinxConfig = array("host" => "172.17.17.105", "port" => 9020); $cateid = 8408; $keyword = "机床"; testAction($keyword, $cateid); /* sphinxql测试 */ function testAction($cateid) { $sphinxConfig = array("host" => "172.17.17.105", "port" => 9020); $conn = new \Foolz\SphinxQL\Connection(); $conn->setParams(array('host' => $sphinxConfig["host"], 'port' => $sphinxConfig["port"])); $query = \Foolz\SphinxQL\SphinxQL::create($conn); $query->select(array("id", "cate3"))->from("product_distri_29"); $query->where("cate3", "=", intval($cateid)); $query->limit(0, 1000); $query->option("max_matches", 4000); try { echo $query->compileSelect()->getCompiled(); echo "\n"; exit;