I started messing around with the Elastic Search Bundle with Symfony 2 and asked a question about the search function with entities.
If you have this configuration:
foq_elastica: clients: default: { host: localhost, port: 9200 } indexes: website: client: default types: user: mappings: username: { boost: 5 } firstName: { boost: 3 } persistence: driver: orm # orm, mongodb, propel are available model: Application\UserBundle\Entity\User provider:
Then you can search indexes as follows:
$userType = $this->container->get('foq_elastica.index.website.user'); $resultSet = $userType->search('bob');
But what if you want to search for multiple objects with a single function? Sort of...
Configuration:
foq_elastica: clients: default: { host: localhost, port: 9200 } indexes: website: client: default types: user: mappings: username: { boost: 5 } firstName: { boost: 3 } persistence: driver: orm model: Application\UserBundle\Entity\User provider: client: mappings: clientname: { boost: 5 } persistence: driver: orm model: Application\UserBundle\Entity\Client provider:
Search function:
$Type = $this->container->get(['foq_elastica.index.website.user', 'foq_elastica.index.website.client']); $resultSet = $Type->search('bob');
The code above does not work, but I was wondering if there is a way to do this one search on multiple objects and get results based on their boost property?
source share