1. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XS.class.php at line 711
702703704705706707708709710711712713714715 spl_autoload_register('XS::autoload', true, true);
/**
* 修改默认的错误处理函数
* 把发生的错误修改为抛出异常, 方便统一处理
*/
function xsErrorHandler($errno, $error, $file, $line)
{
if (($errno & ini_get('error_reporting')) && !strncmp($file, XS_LIB_ROOT, strlen(XS_LIB_ROOT))) {
throw new XSErrorException($errno, $error, $file, $line);
}
return false;
}
set_error_handler('xsErrorHandler');
2. xsErrorHandler(2, 'fsockopen(): php_network_getaddr...', '/www/web/fecshop/vendor/hightman...', 476, ...)
3. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XSServer.class.php at line 476 – fsockopen('xunsearch', 8384, 0, 'php_network_getaddresses: getadd...', ...)
470471472473474475476477478479480481482 $host = substr($conn, 0, $pos);
$port = intval(substr($conn, $pos + 1));
} else {
$host = 'unix://' . $conn;
$port = -1;
}
if (($sock = @fsockopen($host, $port, $errno, $error, 5)) === false) {
throw new XSException($error . '(C#' . $errno . ', ' . $host . ':' . $port . ')');
}
// set socket options
$timeout = ini_get('max_execution_time');
$timeout = $timeout > 0 ? ($timeout - 1) : 30;
4. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XSServer.class.php at line 172 – XSServer::connect()
166167168169170171172173174175176177178 {
$this->close();
$this->_conn = $conn;
$this->_flag = self::BROKEN;
$this->_sendBuffer = '';
$this->_project = null;
$this->connect();
$this->_flag ^= self::BROKEN;
if ($this->xs instanceof XS) {
$this->setProject($this->xs->getName());
}
}
5. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XSSearch.class.php at line 57 – XSServer::open('xunsearch:8384')
51525354555657585960616263 * 每次重新连接后所有的搜索语句相关设置均被还原
* @param string $conn
* @see XSServer::open
*/
public function open($conn)
{
parent::open($conn);
$this->_prefix = array();
$this->_fieldSet = false;
$this->_lastCount = false;
}
/**
6. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XSServer.class.php at line 147 – XSSearch::open('xunsearch:8384')
141142143144145146147148149150151152153 * @param XS $xs 需要捆绑的 xs 对象
*/
public function __construct($conn = null, $xs = null)
{
$this->xs = $xs;
if ($conn !== null) {
$this->open($conn);
}
}
/**
* 析构函数, 关闭连接
*/
7. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XS.class.php at line 450 – XSServer::__construct('xunsearch:8384', XS)
444445446447448449450451452453454455456 }
if (count($conns) > 1) {
shuffle($conns);
}
for ($i = 0; $i < count($conns); $i++) {
try {
$this->_search = new XSSearch($conns[$i], $this);
$this->_search->setCharset($this->getDefaultCharset());
return $this->_search;
} catch (XSException $e) {
if (($i + 1) === count($conns)) {
throw $e;
}
8. in /www/web/fecshop/vendor/hightman/xunsearch/lib/XS.class.php at line 186 – XS::getSearch()
180181182183184185186187188189190191192 * @throw XSException 属性不存在或不可读时抛出异常
*/
public function __get($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter();
}
// throw exception
$msg = method_exists($this, 'set' . $name) ? 'Write-only' : 'Undefined';
$msg .= ' property: ' . get_class($this) . '::$' . $name;
throw new XSException($msg);
9. in /www/web/fecshop/vendor/hightman/xunsearch/wrapper/yii2-ext/Database.php at line 91 – XSComponent::__get('search')
85868788899091929394959697
/**
* @return \XSSearch get xunsearch search object
*/
public function getSearch()
{
return $this->xs->search;
}
/**
* @return QueryBuilder
*/
public function getQueryBuilder()
10. in /www/web/fecshop/vendor/hightman/xunsearch/wrapper/yii2-ext/QueryBuilder.php at line 72 – hightman\xunsearch\Database::getSearch()
66676869707172737475767778 if ($query->query === null) {
$query->query = $this->buildWhere($query->where, $others);
}
$profile = $this->db->getName() . '.build#' . $query->query;
Yii::beginProfile($profile, __METHOD__);
$search = $this->db->getSearch();
$search->setFuzzy($query->fuzzy)->setAutoSynonyms($query->synonyms);
$search->setQuery($query->query);
if (isset($others['range'])) {
$this->buildRange($others['range']);
}
if (isset($others['weight'])) {
11. in /www/web/fecshop/vendor/hightman/xunsearch/wrapper/yii2-ext/ActiveQuery.php at line 345 – hightman\xunsearch\QueryBuilder::build(hightman\xunsearch\ActiveQuery)
339340341342343344345346347 */
private function buildSearch(&$db)
{
if ($db === null) {
$db = $this->getDb();
}
return $this->_search = $db->getQueryBuilder()->build($this);
}
}
12. in /www/web/fecshop/vendor/hightman/xunsearch/wrapper/yii2-ext/ActiveQuery.php at line 212 – hightman\xunsearch\ActiveQuery::buildSearch(hightman\xunsearch\Database)
206207208209210211212213214215216217218 * If null, the DB returned by [[modelClass]] will be used.
* @return array|ActiveRecord[] the search results. If the results in nothing, an empty array will be returned.
*/
public function all($db = null)
{
$query = $this->query;
$search = $this->buildSearch($db);
$this->beforeSearch();
$profile = $db->getName() . '.findAll#' . $this->query;
Yii::beginProfile($profile, __METHOD__);
$docs = $search->search($query);
Yii::endProfile($profile, __METHOD__);
return $this->populate($docs);
13. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/search/XunSearch.php at line 162 – hightman\xunsearch\ActiveQuery::all()
156157158159160161162163164165166167168 }
}
}
$XunSearchQuery->orderBy(['score' => SORT_DESC]);
$XunSearchQuery->limit($product_search_max_count);
$XunSearchQuery->offset(0);
$search_data = $XunSearchQuery->all();
$data = [];
foreach ($search_data as $one) {
if (!isset($data[$one['spu']])) {
$data[$one['spu']] = $one;
}
14. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/search/XunSearch.php at line 126 – fecshop\services\search\XunSearch::fullTearchText(['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...)
120121122123124125126127128129130131132
/**
* 得到搜索的产品列表.
*/
protected function actionGetSearchProductColl($select, $where, $pageNum, $numPerPage, $product_search_max_count)
{
$collection = $this->fullTearchText($select, $where, $pageNum, $numPerPage, $product_search_max_count);
$collection['coll'] = Yii::$service->category->product->convertToCategoryInfo($collection['coll']);
//var_dump($collection);
//exit;
return $collection;
}
15. fecshop\services\search\XunSearch::actionGetSearchProductColl(['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...)
16. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/Service.php at line 49 – call_user_func_array([fecshop\services\search\XunSearch, 'actionGetSearchProductColl'], [['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...])
43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
17. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/Search.php at line 122 – fecshop\services\Service::__call('getSearchProductColl', [['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...])
116117118119120121122123124125126127128 if (is_array($searchLang) && !empty($searchLang)) {
$searchLangCode = array_keys($searchLang);
// 如果当前store的语言,在当前的搜索引擎中支持,则会使用这个搜索,作为支持。
if (in_array($currentLangCode, $searchLangCode)) {
return $service->getSearchProductColl($select, $where, $pageNum, $numPerPage, $product_search_max_count, $filterAttr);
}
}
}
}
}
18. fecshop\services\Search::actionGetSearchProductColl(['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...)
19. in /www/web/fecshop/vendor/fancyecommerce/fecshop/services/Service.php at line 49 – call_user_func_array([fecshop\services\Search, 'actionGetSearchProductColl'], [['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...])
43444546474849505152535455 } else {
$method = 'action'.ucfirst($originMethod);
$this->_callFuncLog[$originMethod] = $method;
}
if (method_exists($this, $method)) {
$this->beginCall($originMethod, $arguments);
$return = call_user_func_array([$this, $method], $arguments);
$this->endCall($originMethod, $arguments);
return $return;
} else {
throw new InvalidCallException('fecshop service method is not exit. '.get_class($this)."::$method");
}
20. in /www/web/fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php at line 331 – fecshop\services\Service::__call('getSearchProductColl', [['product_id', 'sku', 'spu', 'name', ...], ['$text' => ['$search' => '8888']], 1, 30, ...])
325326327328329330331332333334335336337 $where = $this->_where;
$search_text = Yii::$app->controller->module->params['search_query'];
$pageNum = $this->getPageNum();
$numPerPage = $this->getNumPerPage();
$product_search_max_count = Yii::$app->controller->module->params['product_search_max_count'];
$filterAttr = $this->getFilterAttr();
return Yii::$service->search->getSearchProductColl($select, $where, $pageNum, $numPerPage, $product_search_max_count, $filterAttr);
}
/**
* 初始化where
*/
protected function initWhere()
{
21. in /www/web/fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php at line 50 – fecshop\app\appfront\modules\Catalogsearch\block\index\Index::getSearchProductColl()
44454647484950515253545556 $this->getNumPerPage();
//echo Yii::$service->page->translate->__('fecshop,{username}', ['username' => 'terry']);
$this->initSearch();
// change current layout File.
//Yii::$service->page->theme->layoutFile = 'home.php';
$productCollInfo = $this->getSearchProductColl();
$products = $productCollInfo['coll'];
$this->_productCount = $productCollInfo['count'];
//echo $this->_productCount;
return [
'searchText' => $this->_searchText,
'title' => $this->_title,
22. in /www/web/fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php at line 28 – fecshop\app\appfront\modules\Catalogsearch\block\index\Index::getLastData()
2223242526272829303132 parent::init();
}
//
public function actionIndex()
{
$data = $this->getBlock()->getLastData();
return $this->render($this->action->id, $data);
}
}
23. fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController::actionIndex()
24. in /www/web/fecshop/vendor/yiisoft/yii2/base/InlineAction.php at line 57 – call_user_func_array([fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController, 'actionIndex'], [])
25. in /www/web/fecshop/vendor/yiisoft/yii2/base/Controller.php at line 157 – yii\base\InlineAction::runWithParams(['q' => '8888'])
26. in /www/web/fecshop/vendor/yiisoft/yii2/base/Module.php at line 528 – yii\base\Controller::runAction('', ['q' => '8888'])
27. in /www/web/fecshop/vendor/yiisoft/yii2/web/Application.php at line 103 – yii\base\Module::runAction('catalogsearch/index', ['q' => '8888'])
28. in /www/web/fecshop/vendor/yiisoft/yii2/base/Application.php at line 386 – yii\web\Application::handleRequest(fecshop\yii\web\Request)
29. in /www/web/fecshop/appfront/web/cn/index.php at line 90 – yii\base\Application::run()
84858687888990 * 上面的例子就是获取cms服务的子服务article。
*/
new fecshop\services\Application($config['services']);
unset($config['services']);
$application = new yii\web\Application($config);
$application->run();
$_GET = [
'q' => '8888',
];
$_COOKIE = [
'PHPSESSID' => '8a01bf5152d3c1c872b97f711f399749',
'_csrf' => '56244ed261bc77ded14456e25e2b8ecc11d0cebebce31ceb4dc7057f7d592a64a:2:{i:0;s:5:"_csrf";i:1;s:32:"1xAmBgCpeZL6-MU-gpGWhCN31hwiuJbj";}',
];
$_SESSION = [
'__flash' => [],
'currency_current' => 'CNY',
];
某帖子中说要在etc/hosts里添加 127.0.0.1,已添加,但是问题依旧。
然后查找到一个步骤说要跑脚本:
cd vendor/fancyecommerce/fecshop/shell/search
sh fullSearchSync.sh
但是xshell里面报错。
/usr/bin/env: php: No such file or directory
/usr/bin/env: php: No such file or directory
/usr/bin/env: php: No such file or directory
/usr/bin/env: php: No such file or directory
There are products to process
There are pages to process
##############ALL BEGINING###############
fullSearchSync.sh: line 17: ((: i<=: syntax error: operand expected (error token is "<=")
/usr/bin/env: php: No such file or directory
##############ALL COMPLETE###############