updated to 1.2
This commit is contained in:
@@ -18,9 +18,9 @@
|
||||
* is set afterwards.
|
||||
*
|
||||
* @param array $call_args
|
||||
* An associative array containing all four arguments to the
|
||||
* Apache_Solr_Service::search() call ("query", "offset", "limit" and
|
||||
* "params") as references.
|
||||
* An associative array containing all three arguments to the
|
||||
* SearchApiSolrConnectionInterface::search() call ("query", "params" and
|
||||
* "method") as references.
|
||||
* @param SearchApiQueryInterface $query
|
||||
* The SearchApiQueryInterface object representing the executed search query.
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ function hook_search_api_solr_query_alter(array &$call_args, SearchApiQueryInter
|
||||
/**
|
||||
* Change the way the index's field names are mapped to Solr field names.
|
||||
*
|
||||
* @param $index
|
||||
* @param SearchApiIndex $index
|
||||
* The index whose field mappings are altered.
|
||||
* @param array $fields
|
||||
* An associative array containing the index field names mapped to their Solr
|
||||
@@ -47,34 +47,50 @@ function hook_search_api_solr_field_mapping_alter(SearchApiIndex $index, array &
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets modules alter the search results returned from a Solr search, based on
|
||||
* the original Solr response.
|
||||
* Alter Solr documents before they are sent to Solr for indexing.
|
||||
*
|
||||
* @param array $documents
|
||||
* An array of SearchApiSolrDocument objects ready to be indexed, generated
|
||||
* from $items array.
|
||||
* @param SearchApiIndex $index
|
||||
* The search index for which items are being indexed.
|
||||
* @param array $items
|
||||
* An array of items being indexed.
|
||||
*/
|
||||
function hook_search_api_solr_documents_alter(array &$documents, SearchApiIndex $index, array $items) {
|
||||
// Adds a "foo" field with value "bar" to all documents.
|
||||
foreach ($documents as $document) {
|
||||
$document->setField('foo', 'bar');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets modules alter the search results returned from a Solr search.
|
||||
*
|
||||
* @param array $results
|
||||
* The results array that will be returned for the search.
|
||||
* @param SearchApiQueryInterface $query
|
||||
* The SearchApiQueryInterface object representing the executed search query.
|
||||
* @param Apache_Solr_Response $response
|
||||
* The response object returned by Solr.
|
||||
* @param object $response
|
||||
* The Solr response object.
|
||||
*/
|
||||
function hook_search_api_solr_search_results_alter(array &$results, SearchApiQueryInterface $query, Apache_Solr_Response $response) {
|
||||
function hook_search_api_solr_search_results_alter(array &$results, SearchApiQueryInterface $query, $response) {
|
||||
if (isset($response->facet_counts->facet_fields->custom_field)) {
|
||||
// Do something with $results.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Lets modules alter a Solr search request for a multi-index search before
|
||||
* sending it.
|
||||
* Lets modules alter a Solr search request for a multi-index search.
|
||||
*
|
||||
* Apache_Solr_Service::search() is called afterwards with these parameters.
|
||||
* Please see this method for details on what should be altered where and what
|
||||
* is set afterwards.
|
||||
* SearchApiSolrConnectionInterface::search() is called afterwards with these
|
||||
* parameters. Please see this method for details on what should be altered
|
||||
* where and what is set afterwards.
|
||||
*
|
||||
* @param array $call_args
|
||||
* An associative array containing all four arguments to the
|
||||
* Apache_Solr_Service::search() call ("query", "offset", "limit" and
|
||||
* "params") as references.
|
||||
* An associative array containing all three arguments to the
|
||||
* SearchApiSolrConnectionInterface::search() call ("query", "params" and
|
||||
* "method") as references.
|
||||
* @param SearchApiMultiQueryInterface $query
|
||||
* The object representing the executed search query.
|
||||
*/
|
||||
@@ -84,46 +100,6 @@ function hook_search_api_solr_multi_query_alter(array &$call_args, SearchApiMult
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define how Search API Solr should index different data types.
|
||||
*
|
||||
* It is important to make sure that any types you define are also declared to
|
||||
* Search API using hook_search_api_data_type_info().
|
||||
*
|
||||
* @return array
|
||||
* An array containing data type definitions, keyed by their type identifier
|
||||
* and containing the following keys:
|
||||
* - prefix: The prefix used by the dynamic field type.
|
||||
* - always multiValued: (optional) Whether the single/multiple prefix should
|
||||
* be skipped for this data type. Defaults to FALSE.
|
||||
*
|
||||
* @see hook_search_api_solr_dynamic_field_info_alter()
|
||||
* @see search_api_solr_get_dynamic_field_info()
|
||||
* @see hook_search_api_data_type_info().
|
||||
*/
|
||||
function hook_search_api_solr_dynamic_field_info() {
|
||||
return array(
|
||||
'example_type' => array(
|
||||
'prefix' => 'ex',
|
||||
// Could be omitted, as FALSE is the default.
|
||||
'always multiValued' => FALSE,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alter the data type indexing info.
|
||||
*
|
||||
* @param array $infos
|
||||
* The item type info array, keyed by type identifier.
|
||||
*
|
||||
* @see hook_search_api_solr_dynamic_field_info()
|
||||
*/
|
||||
function hook_search_api_solr_dynamic_field_info_alter(array &$infos) {
|
||||
// Change the prefix used for example_type.
|
||||
$info['example_type']['prefix'] = 'ex2';
|
||||
}
|
||||
|
||||
/**
|
||||
* @} End of "addtogroup hooks".
|
||||
*/
|
||||
|
Reference in New Issue
Block a user