Antidot PHP API  version 0.16.0
##PHP API to simplify integration of Antidot components
 All Classes Files Functions Variables Groups Pages
Public Member Functions | List of all members
AfsResponseHelper Class Reference

Main helper for AFS search reply. More...

Inheritance diagram for AfsResponseHelper:
AfsResponseHelperBase

Public Member Functions

 __construct ($response, AfsQuery $query, AfsHelperConfiguration $config)
 Construct new response helper instance.
Replies
 has_replyset ($feed=null)
 Check whether reponse has a reply. Possible to check reply for on feed or for all feeds.
 get_replysets ()
 Retrieves all replysets.
 get_replyset ($feed=null)
 Retrieves replyset from the response.
Spellcheck
 has_spellcheck ()
 Checks whether at least one spellcheck is defined.
 get_spellchecks ()
 Retrieves spellchecks from the response.
 get_spellcheck ($feed=null)
 Retrieves default, available or specified spellcheck.
Promote
 has_promote ()
 Checks whether at least one promote is available.
 get_promotes ()
 Retrieves all promote helpers.
 get_promote ()
 Retrieves promote replyset helper.
Concept
 has_concept ()
 Checks whether at least one concept is available.
 get_concepts ()
 Retrieves all concept helpers.
 get_concept ($feed=null)
 Retrieves default or specified concept.
- Public Member Functions inherited from AfsResponseHelperBase
 in_error ()
 Check whether an error has been raised.
 get_error_msg ()
 Retrieve error message.

Miscellaneaous

 get_duration ()
 Retrieves AFS search engine computation duration.
 format ()
 Retrieves reply data as array.
 get_query_parameter ($key)
 Retrieve query parameter stored in header $key : Name of the parameter.

Additional Inherited Members

- Protected Member Functions inherited from AfsResponseHelperBase
 set_error_msg ($msg)

Detailed Description

Main helper for AFS search reply.

This helper is intended to be initiliazed with the reply provided by AfsSearchQueryManager::send. It allows to manage replies of one of the available replysets, including facets and pager. Connection and query errors are managed in a uniform way to simplify integration.

Examples:
full_example.php.

Constructor & Destructor Documentation

__construct (   $response,
AfsQuery  $query,
AfsHelperConfiguration  $config 
)

Construct new response helper instance.

Parameters
$response[in] result from AfsSearchQueryManager::send call.
$query[in] query which has produced current reply.
$config[in] helper configuration object.
Exceptions
InvalidArgumentExceptionwhen one of the parameters is invalid.

Member Function Documentation

format ( )

Retrieves reply data as array.

This method is intended for internal use only.

All data are stored in key => value format:

  • replysets: replies per feed,
  • spellchecks: spellcheck replies per feed.
Returns
array filled with key and values.
get_concept (   $feed = null)

Retrieves default or specified concept.

For more details see AfsConceptManager::get_concept.

Parameters
$feed[in] Concept generated by this feed should be retrieved (default: default concept is retrieved).
Returns
appropriate concept.
get_concepts ( )

Retrieves all concept helpers.

Returns
concept replies.
get_duration ( )

Retrieves AFS search engine computation duration.

Individual durations are available for each replyset, see AfsReplysetHelper for more details.

Returns
Computation duration in milliseconds.
get_promote ( )

Retrieves promote replyset helper.

This allows to retrieve metadata of the promote. For more details see AfsPromoteReplysetHelper.

Returns
promote replyset helper.
get_promotes ( )

Retrieves all promote helpers.

Returns
promote replies.
get_query_parameter (   $key)

Retrieve query parameter stored in header $key : Name of the parameter.

Returns
value of the parameter
get_replyset (   $feed = null)

Retrieves replyset from the response.

Parameters
$feed[in] name of the feed to filter on (default: null -> retrieves first replyset).
Returns
AfsReplysetHelper or formatted replyset depending on format parameter.
get_replysets ( )

Retrieves all replysets.

Returns
all defined reply sets.
get_spellcheck (   $feed = null)

Retrieves default, available or specified spellcheck.

Parameters
$feed[in] Feed for which spellcheck should be retrieved. Default value is null, two cases can occur:
  • there is only one spellcheck reply which is returned,
  • there is multiple spellcheck replies and one corresponds to default spellcheck reply (AFS_DEFAULT_SPELLCHECK); this one is returned.
Returns
spellcheck helper (see AfsSpellcheckHelper).
Exceptions
OutOfBoundsExceptionwhen required feed has not produced any spellcheck reply.
get_spellchecks ( )

Retrieves spellchecks from the response.

Returns
list of AfsSpellcheckHelper or formatted spellcheck depending on parameter initialization.
has_concept ( )

Checks whether at least one concept is available.

Returns
True when one or more concepts is available, false otherwise.
has_promote ( )

Checks whether at least one promote is available.

Returns
True when one or more promotes is available, false otherwise.
has_replyset (   $feed = null)

Check whether reponse has a reply. Possible to check reply for on feed or for all feeds.

Parameters
$feedname to be checked
Returns
true when a reply is available, false otherwise.
has_spellcheck ( )

Checks whether at least one spellcheck is defined.

Returns
True when one or more spellchecks are defined, false otherwise.