Reputation: 1557
I am using Laravel 5.1
and the mustafaaloko/elasticquent5
package (found here).
But when trying to return results, I can only get results when searching for the exact word. If I try to search part of the word, it returns nothing.
I am using Profile::addAllToIndex();
and dd(Profile::search(Input::get('search_term')));
My config looks like this:
<?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',
);
Upvotes: 0
Views: 240
Reputation: 217474
You should try to use searchByQuery
instead of search
and use a query_string
query
Profile::searchByQuery(array('query_string' => array('query' => Input::get('search_term'))));
Upvotes: 1