Basic search
You can search for documents in your Algolia with a single line of code. Thesearch method queries Algolia for matching results and returns an array of Doctrine-managed objects (ORM entities or ODM documents).
The objects are loaded from your database through the Doctrine Manager you pass in.
Both
SearchService and Doctrine\Persistence\ManagerRegistry must be injected into your class,
so that you can use $this->searchService and $this->managerRegistry.PHP
search method only retrieves a list of IDs from the engine and uses them
to hydrate the corresponding Doctrine objects from your database.
You can only pass parameters to modify what to search, not modify the type of response.
If you want to modify the attributes to retrieve or retrieve data like facets, facets_stats, or _rankingInfo,
use the rawSearch method.
Request options
The search and write methods inSearchService take a $requestOptions array as their last argument.
For search(), rawSearch(), and count(), any top-level keys that aren’t HTTP options become search parameters sent to Algolia, for example, to change the page, filter the results, or choose what attributes to retrieve.
You can find all possibilities in the list of search API parameters.
For write methods (index(), remove(), clear(), delete()), $requestOptions is passed directly to the PHP client, so only supported request-option keys (such as headers, queryParameters, and timeouts) apply.
PHP
Raw search
If you want to get the raw results from Algolia, use therawSearch method.
This is the method you’ll need to use if you want to retrieve the highlighted snippets or ranking information for instance.
It takes a $requestOptions array as an optional last parameter.
PHP
search method is that you won’t retrieve Doctrine-managed objects,
but a PHP associative array containing the raw engine response.
Count
Use this method when you only need the number of results for a query.count still triggers a search request.
PHP
Clear
Theclear method deletes the in an index without affecting its settings.
It takes the class name associated with an index and, optionally, $requestOptions as the last parameter.
This method is waitable.
PHP
Delete
Delete an index and all its settings, including links to its replicas. It takes the class name associated with an index and, optionally,$requestOptions as the last parameter.
This method is waitable as well.
PHP