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