搜索突然报错了,之前是好的

bug问题 · fecshoper · 于 6年前 发布 · 2656 次阅读
An Error occurred while handling another error:
exception 'ReflectionException' with message 'Method fecshop\services\search\MongoSearch::getSearchProductColl() does not exist' in /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php:195
Stack trace:
#0 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(195): ReflectionMethod->__construct('fecshop\\service...', 'getSearchProduc...')
#1 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php(26): yii\web\ErrorHandler->addTypeLinks('fecshop\\service...')
#2 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/alidata/www/yi...')
#3 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/alidata/www/yi...', Array)
#4 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#5 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(304): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#6 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(326): yii\web\ErrorHandler->renderCallStackItem('/alidata/www/yi...', 121, 'fecshop\\service...', 'getSearchProduc...', Array, 9)
#7 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/views/errorHandler/exception.php(381): yii\web\ErrorHandler->renderCallStack(Object(yii\mongodb\Exception))
#8 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/alidata/www/yi...')
#9 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/alidata/www/yi...', Array)
#10 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#11 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(116): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#12 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(yii\mongodb\Exception))
#13 [internal function]: yii\base\ErrorHandler->handleException(Object(yii\mongodb\Exception))
#14 {main}
Previous exception:
exception 'MongoDB\Driver\Exception\RuntimeException' with message 'text index required for $text query' in /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Command.php:286
Stack trace:
#0 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Command.php(286): MongoDB\Driver\Manager->executeQuery('fecshop.full_se...', Object(MongoDB\Driver\Query), Object(MongoDB\Driver\ReadPreference))
#1 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Command.php(614): yii\mongodb\Command->query('<span class="st...', '[<span class="s...')
#2 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Collection.php(218): yii\mongodb\Command->find('<span class="st...', '[<span class="s...', '[<span class="s...')
#3 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(277): yii\mongodb\Collection->find('[<span class="s...', '[<span class="s...', '[<span class="s...')
#4 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(226): fecshop\services\search\MongoSearch->fullTearchText('[<span class="s...')
#5 [internal function]: fecshop\services\search\MongoSearch->actionGetSearchProductColl('[<span class="s...', '[<span class="s...', '<span class="nu...', '<span class="nu...', '...')
#6 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array('[<span class="t...', '[[<span class="...')
#7 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Search.php(121): fecshop\services\Service->__call('<span class="st...', '[[<span class="...')
#8 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Search.php(121): fecshop\services\search\MongoSearch->getSearchProductColl(Array, Array, 1, 30, 1000)
#9 [internal function]: fecshop\services\Search->actionGetSearchProductColl(Array, Array, 1, 30, 1000)
#10 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array(Array, Array)
#11 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(342): fecshop\services\Service->__call('getSearchProduc...', Array)
#12 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(342): fecshop\services\Search->getSearchProductColl(Array, Array, 1, 30, 1000)
#13 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(50): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getSearchProductColl()
#14 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php(28): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getLastData()
#15 [internal function]: fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController->actionIndex()
#16 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#17 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#18 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
#19 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('catalogsearch/i...', Array)
#20 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#21 /alidata/www/yii2_fecshop/appfront/web/index.php(85): yii\base\Application->run()
#22 {main}

Next exception 'yii\mongodb\Exception' with message 'text index required for $text query' in /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Command.php:292
Stack trace:
#0 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Command.php(614): yii\mongodb\Command->query('<span class="st...', '[<span class="s...')
#1 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2-mongodb/Collection.php(218): yii\mongodb\Command->find('<span class="st...', '[<span class="s...', '[<span class="s...')
#2 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(277): yii\mongodb\Collection->find('[<span class="s...', '[<span class="s...', '[<span class="s...')
#3 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/search/MongoSearch.php(226): fecshop\services\search\MongoSearch->fullTearchText('[<span class="s...')
#4 [internal function]: fecshop\services\search\MongoSearch->actionGetSearchProductColl('[<span class="s...', '[<span class="s...', '<span class="nu...', '<span class="nu...', '...')
#5 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array('[<span class="t...', '[[<span class="...')
#6 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Search.php(121): fecshop\services\Service->__call('<span class="st...', '[[<span class="...')
#7 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Search.php(121): fecshop\services\search\MongoSearch->getSearchProductColl(Array, Array, 1, 30, 1000)
#8 [internal function]: fecshop\services\Search->actionGetSearchProductColl(Array, Array, 1, 30, 1000)
#9 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array(Array, Array)
#10 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(342): fecshop\services\Service->__call('getSearchProduc...', Array)
#11 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(342): fecshop\services\Search->getSearchProductColl(Array, Array, 1, 30, 1000)
#12 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/block/index/Index.php(50): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getSearchProductColl()
#13 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php(28): fecshop\app\appfront\modules\Catalogsearch\block\index\Index->getLastData()
#14 [internal function]: fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController->actionIndex()
#15 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#17 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
#18 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('catalogsearch/i...', Array)
#19 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#20 /alidata/www/yii2_fecshop/appfront/web/index.php(85): yii\base\Application->run()
#21 {main}
共收到 8 条回复
Fecmall#16年前 0 个赞

你是不是删除过mongodb的表? 或者你的当前语言下面,没有跑过mongodb search的脚本?

你可以看到上面有各个语言对应的搜索表,因为各个语言的分词情况不同,因此每个语言对应的搜索表是一张collection。

因此你需要做的是:

1.打开 @common/config/fecshop_local_services/Search.php 查看:

return [
	'search' => [
		'class' => 'fecshop\services\Search',
		'filterAttr' => [
			'color','size', # 在搜索页面侧栏的搜索过滤属性字段
		],
		'childService' => [
			'mongoSearch' => [
				'class' 		=> 'fecshop\services\search\MongoSearch',
				'searchIndexConfig'  => [
					'name' => 10,  
					'description' => 5,  
				], 
				#more : https://docs.mongodb.com/manual/reference/text-search-languages/#text-search-languages
				'searchLang'  => [
					'en' => 'english',
					'fr' => 'french',
					'de' => 'german',
					'es' => 'spanish',
					'ru' => 'russian',
					'pt' => 'portuguese',
				],
			],
			'xunSearch'  => [
				'class' 		=> 'fecshop\services\search\XunSearch',
				'fuzzy' => true,  # 是否开启模糊查询
				'synonyms' => true, #是否开启同义词翻译
				'searchLang'    => [
					'zh' => 'chinese',
				],
			],
		],
	]
];

你的对应语言这里是否存在

2.重新跑一下脚本:

[root@iZ942k2d5ezZ search]# pwd
/www/web/develop/fecshop/vendor/fancyecommerce/fecshop/shell/search
[root@iZ942k2d5ezZ search]# sh fullSearchSync.sh 
There are 37 products to process
There are 1 pages to process
##############ALL BEGINING###############
Page 1 done
begin delete Mongodb Search Date 
##############ALL COMPLETE###############
[root@iZ942k2d5ezZ search]# 

参考资料:http://www.fecshop.com/doc/fecshop-guide/instructions/cn-1.0/guide-fecshop_search.html#

Fecmall#26年前 0 个赞

另外,mongodb的全文搜索,不是任何语言都默认支持,譬如中文,韩文,就不支持

fecshoper#36年前 0 个赞

@Terry [#2楼](#comment2) 只有 english,报错不可怕,主要是不好定位错误

Fecmall#46年前 1 个赞

@fecshoper #3楼 有报错信息,还不好定位吗?

这不是有报错吗? text index required for $text query

可怕的是有报错信息,你自己看不懂,也不看,也不搜索,不想自己尝试解决问题, 报错说mongodb没有 $text索引,搜索一下,肯定明白这是个啥。信息都给予了,自己解决!

fecshoper#56年前 0 个赞

@Terry [[#4楼](#comment4)](#comment4) 好,但是搜索遇到另外的问题,如图


An Error occurred while handling another error:
exception 'ReflectionException' with message 'Method fecshop\services\product\Image::getResize() does not exist' in /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php:195
Stack trace:
#0 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(195): ReflectionMethod->__construct('fecshop\\service...', 'getResize')
#1 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/views/errorHandler/callStackItem.php(26): yii\web\ErrorHandler->addTypeLinks('fecshop\\service...')
#2 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/alidata/www/yi...')
#3 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/alidata/www/yi...', Array)
#4 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#5 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(304): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#6 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(326): yii\web\ErrorHandler->renderCallStackItem('/alidata/www/yi...', 73, 'fecshop\\service...', 'getResize', Array, 11)
#7 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/views/errorHandler/exception.php(381): yii\web\ErrorHandler->renderCallStack(Object(Imagine\Exception\RuntimeException))
#8 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/alidata/www/yi...')
#9 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/alidata/www/yi...', Array)
#10 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(249): yii\base\View->renderFile('@yii/views/erro...', Array, Object(yii\web\ErrorHandler))
#11 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/ErrorHandler.php(116): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#12 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/ErrorHandler.php(111): yii\web\ErrorHandler->renderException(Object(Imagine\Exception\RuntimeException))
#13 [internal function]: yii\base\ErrorHandler->handleException(Object(Imagine\Exception\RuntimeException))
#14 {main}
Previous exception:
exception 'ErrorException' with message 'imagejpeg(/alidata/www/yii2_fecshop/appimage/common/media/catalog/product/cache/bd935443df1c50537d4edaab4af5d446/230/230http://img.51openheart.cn/media/catalog/product/default.jpg): failed to open stream: No such file or directory' in /alidata/www/yii2_fecshop/vendor/imagine/imagine/lib/Imagine/Gd/Image.php:584
Stack trace:
#0 [internal function]: Imagine\Gd\Image->Imagine\Gd\{closure}('<span class="nu...', '<span class="st...', '<span class="st...', '<span class="nu...', '...')
#1 [internal function]: imagejpeg('<span class="ke...', '<span class="st...')
#2 /alidata/www/yii2_fecshop/vendor/imagine/imagine/lib/Imagine/Gd/Image.php(584): call_user_func_array('<span class="st...', '[<span class="n...')
#3 /alidata/www/yii2_fecshop/vendor/imagine/imagine/lib/Imagine/Gd/Image.php(210): Imagine\Gd\Image->saveOrOutput('<span class="st...', '[]', '<span class="st...')
#4 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fec/helpers/CImage.php(140): Imagine\Gd\Image->save('<span class="st...')
#5 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/product/Image.php(129): fec\helpers\CImage::saveResizeMiddleWaterImg('<span class="st...', '<span class="st...', '[<span class="n...', '<span class="st...')
#6 [internal function]: fecshop\services\product\Image->actionGetResize('<span class="st...', '[<span class="n...', '<span class="ke...')
#7 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/services/Service.php(48): call_user_func_array('[<span class="t...', '[<span class="s...')
#8 /alidata/www/yii2_fecshop/appfront/theme/terry/theme01/catalogsearch/index/index.php(73): fecshop\services\Service->__call('<span class="st...', '[<span class="s...')
#9 /alidata/www/yii2_fecshop/appfront/theme/terry/theme01/catalogsearch/index/index.php(73): fecshop\services\product\Image->getResize('http://img.51op...', Array, false)
#10 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(330): require('/alidata/www/yi...')
#11 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/View.php(250): yii\base\View->renderPhpFile('/alidata/www/yi...', Array)
#12 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/AppfrontController.php(95): yii\base\View->renderFile('/alidata/www/yi...', Array, Object(fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController))
#13 /alidata/www/yii2_fecshop/vendor/fancyecommerce/fecshop/app/appfront/modules/Catalogsearch/controllers/IndexController.php(30): fecshop\app\appfront\modules\AppfrontController->render('index', Array)
#14 [internal function]: fecshop\app\appfront\modules\Catalogsearch\controllers\IndexController->actionIndex()
#15 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#16 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Controller.php(156): yii\base\InlineAction->runWithParams(Array)
#17 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Module.php(523): yii\base\Controller->runAction('', Array)
#18 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/web/Application.php(102): yii\base\Module->runAction('catalogsearch/i...', Array)
#19 /alidata/www/yii2_fecshop/vendor/yiisoft/yii2/base/Application.php(380): yii\web\Application->handleRequest(Object(fecshop\yii\web\Request))
#20 /alidata/www/yii2_fecshop/appfront/web/index.php(85): yii\base\Application->run()
#21 {main}

Fecmall#66年前 0 个赞

自己调试解决

Previous exception:
exception 'ErrorException' with message 'imagejpeg(/alidata/www/yii2_fecshop/appimage/common/media/catalog/product/cache/bd935443df1c50537d4edaab4af5d446/230/230http://img.51openheart.cn/media/catalog/product/default.jpg): failed to open stream: No such file or directory' in /alidata/www/yii2_fecshop/vendor/imagine/imagine/lib/Imagine/Gd/Image.php:584

看报错。调试完了,反馈结果过来

顺藤摸瓜,自己查看下到底哪里问题。

fecshoper#76年前 0 个赞

@Terry #6楼 主要不知道后面为什么是这个路径

Fecmall#86年前 0 个赞

@fecshoper [[[#7楼](#comment7)](#comment7)](#comment7) 自己解决,线上没有问题。

你的版本是什么时候的版本,这个自己看下,和github上面的代码对比下。

另外,能自己解决的,别出点问题就来这里贴,自己一点处理问题的能力都没有吗?这么明确的问题定位,自己去调试就找出来问题了,这么懒还玩什么。

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics