0
我使用的是Laravel 5.1
和mustafaaloko/elasticquent5
包(found here)。Elasticsearch不返回部分结果
但是当试图返回结果时,我只能在搜索确切的单词时得到结果。如果我尝试搜索部分单词,它将不会返回任何内容。
我使用Profile::addAllToIndex();
和dd(Profile::search(Input::get('search_term')));
我的配置是这样的:
<?php
return array(
/*
|--------------------------------------------------------------------------
| Custom Elasticsearch Client Configuration
|--------------------------------------------------------------------------
|
| This array will be passed to the Elasticsearch client.
| See configuration options here:
|
| http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/current/_configuration.html
*/
'config' => [
'hosts' => ['ahp.dev:9200'],
'logging' => true,
'logPath' => storage_path() . '/logs/elasticsearch.log',
'logLevel' => Monolog\Logger::WARNING,
],
/*
|--------------------------------------------------------------------------
| Default Index Name
|--------------------------------------------------------------------------
|
| This is the index name that Elastiquent will use for all
| Elastiquent models.
*/
'default_index' => 'default',
);
我不得不在Input :: get('search_term')'之前和之后加入''*'来进行适应性调整,然后它就起作用了!谢谢! – Haring10
哦,是的,忘记了。伟大的工作!一旦等待期结束, – Val
将接受正确答案 – Haring10