gpt4 book ai didi

php - Elasticsearch不返回部分结果

转载 作者:行者123 更新时间:2023-12-03 01:55:20 24 4
gpt4 key购买 nike

我正在使用Laravel 5.1mustafaaloko/elasticquent5包(found here)。

但是,当尝试返回结果时,只有在搜索确切的单词时才能获得结果。如果我尝试搜索单词的一部分,则不会返回任何内容。

我正在使用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',

);

最佳答案

您应该尝试使用searchByQuery而不是search并使用query_string查询

Profile::searchByQuery(array('query_string' => array('query' => Input::get('search_term'))));

关于php - Elasticsearch不返回部分结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37133427/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com