![]() |
Antidot PHP API
version 0.16.0
##PHP API to simplify integration of Antidot components
|
This API simplifies querying of Antidot search engine. Classes involved in this API are detailled and, when possible, examples are given.
Snippets of code are usable as is and can be joined to build a fully functional example step by step. If you prefer you can get access to full code example full_example.php.
If you have not read it yet you can start by reading AFS search query coder/decoder API.
Instance of AfsSearchConnector is initialized with specific search URL and an instance of AfsService.
Specific search URL is provided by production team and should be similar to http://your_company.afs-antidot.net/search
Along with the search URL, a service number and service status should also have been provided. These informations are used to initialized an instance of AfsService. Production services are not modified in place so their status are usually stable
.
Here an example to initialize an AFS search connector:
Once the connector is initialized, queries can be submitted by calling AfsSearchConnector::send method. This method is generally never called directlty. Instead, call to AfsSearchQueryManager::send (see Query manager) triggers appropriate call to this method.
An array of parameters should be provided to the method. Array key/value pairs should correspond to valid AFS search engine parameter names with valid associated value (see AFS Integration Guide > AFS WEB SERVICES > search > Parameters
).
Provided array of parameters is filled with default parameters such as afs:service
, afs:status
and afs:output
before Antidot search engine is queried.
Facets can be declared and configured by instantiating AfsFacet. The two most important parameters are the facet id and the facet type. These parameters should correspond to the ones provided in the feed
description file on the PaF side.
Each facet should be added to an instance of AfsFacetManager. The order in which facets are added to the manager is highly important because it implies the order in which facets will appear in Antidot search engine reply.
Example of facet and facet manager initialization:
Details on queries are provided in Query.
Here a summarize of the query usages:
Reminder of query initialization:
Query manager combine all previous elements to connect and send query to Antidot search engine. No specific configuration is necessary.
Example of query manager initialization: