This bundle integrates Enrise search into your Symfony application.
Minimal php version is 7
Add the printdeal/pandosearch-bundle
package to your require
section in the composer.json
file.
$ composer require printdeal/pandosearch-bundle 1.0.0
Add the PrintdealPandosearchBundle to your application's kernel:
<?php
public function registerBundles()
{
$bundles = array(
// ...
new Printdeal\PandosearchBundle\PrintdealPandosearchBundle(),
// ...
);
...
}
Configure the printdeal_pandosearch
in your config.yml
:
printdeal_pandosearch:
company_name: 'company.com'
also you can add default parameters for search request:
printdeal_pandosearch:
company_name: 'company.com'
query_settings:
track: false
full: true
nocorrect: true
notiming: true
for more convenience - optional parameter with a custom entity for deserialization can be used:
printdeal_pandosearch:
deserialization_parameters:
search_response_entity: Printdeal\PandosearchBundle\Entity\Search\CustomResponse
suggestion_response_entity: Printdeal\PandosearchBundle\Entity\Suggestion\CustomResponse
In controller you can use your search:
<?php
// get search results
$searchCriteria = new SearchCriteria();
$searchCriteria->setQuery('searchString');
$this->get('printdeal_pandosearch')->search($searchCriteria);
// get search suggestions
$suggestCriteria = new SuggestCriteria();
$suggestCriteria->setQuery('searchString');
$this->get('printdeal_pandosearch')->suggest($suggestCriteria);