Antidot PHP API  version 0.16.0
##PHP API to simplify integration of Antidot components
 All Classes Files Functions Variables Groups Pages
AFS search API

Table of Contents

Introduction

This API greatly simplifies querying of Antidot search engine. Only one class needs to be instanciated.

AFS search initialization

Instance of AfsSearch is initialized with host name hosting AFS search service and the service identifier (id and status which is set to stable by default).

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 the instance of AfsSearch. Production services are not modified in place so their status are usually stable.

Here an example to initialize an AFS search object:

// Third parameter is set to AfsServiceStatus::STABLE by default.
$search = new AfsSearch('eval.partners.antidot.net', 48000);

Once the object is initialized, query can be submitted by calling AfsSearch::execute method.

Query initialization

Here a summarize of the query usages:

If the query should be initialized with URL parameters, this can be done as following:

// Instead, you can initialize new query and call $search->set_query($initial_query)
$search->build_query_from_url_parameters();

Otherwise, you can define initial query and set it with AfsSearch::set_query.

Query AFS search engine

Once the query is initialized, AFS search engine can be queried as following:

// Default format is AfsHelperFormat::ARRAYS, it can be set to AfsHelperFormat::HELPERS
// when execute method is called.

Default result is formatted as array. Alternate result format is available see AfsSearch::execute for more details.

Facets management (optional)

Facets can be declared and configured by instantiating AfsFacet. But, if no specific configuration is necessary, facets are deduced from the reply of AFS search engine.

Example of declaration: