class SearchApiSolrDateSortViewsQuery in Search Api Solr Date Sort 7
Views query class using a Search API index as the data source.
Hierarchy
- class \views_object
- class \views_plugin
- class \views_plugin_query
- class \SearchApiViewsQuery
- class \views_plugin_query
- class \views_plugin
Expanded class hierarchy of SearchApiSolrDateSortViewsQuery
1 string reference to 'SearchApiSolrDateSortViewsQuery'
- search_api_solr_date_sort_views_plugins in ./
search_api_solr_date_sort.views.inc - Implementation of hook_views_plugins().
File
- includes/
views/ query.inc, line 10 - Contains SearchApiViewsQuery.
View source
class SearchApiSolrDateSortViewsQuery extends SearchApiViewsQuery {
/**
* @inheritdoc
*
* This method is largely copied from the SearchApiViewsQuery::get_results_wrappers.
* However, this method handles the unique ids if there are more than 1
* document per node.
*/
public function get_result_wrappers($results, $relationship = NULL, $field = NULL) {
$entity_type = $this->index
->getEntityType();
$wrappers = array();
$load_entities = array();
foreach ($results as $row_index => $row) {
$entity_id = $row->entity;
// Remove the appended: -### to use as entity_id.
$hyphen = strpos($entity_id, "-");
if (!empty($hyphen)) {
$entity_id = substr($row->entity, 0, $hyphen);
}
if ($entity_type && isset($row->entity)) {
// If this entity isn't load, register it for pre-loading.
if (!is_object($row->entity)) {
$load_entities[$row->entity] = $row_index;
}
$wrappers[$row_index] = $this->index
->entityWrapper($entity_id);
}
}
// If the results are entities, we pre-load them to make use of a multiple
// load. (Otherwise, each result would be loaded individually.)
if (!empty($load_entities)) {
$entities = entity_load($entity_type, array_keys($load_entities));
foreach ($entities as $entity_id => $entity) {
$wrappers[$load_entities[$entity_id]] = $this->index
->entityWrapper($entity);
}
}
// Apply the relationship, if necessary.
$type = $entity_type ? $entity_type : $this->index->item_type;
$selector_suffix = '';
if ($field && ($pos = strrpos($field, ':'))) {
$selector_suffix = substr($field, 0, $pos);
}
if ($selector_suffix || $relationship && !empty($this->view->relationship[$relationship])) {
// Use EntityFieldHandlerHelper to compute the correct data selector for
// the relationship.
$handler = (object) array(
'view' => $this->view,
'relationship' => $relationship,
'real_field' => '',
);
$selector = EntityFieldHandlerHelper::construct_property_selector($handler);
$selector .= ($selector ? ':' : '') . $selector_suffix;
list($type, $wrappers) = EntityFieldHandlerHelper::extract_property_multiple($wrappers, $selector);
}
return array(
$type,
$wrappers,
);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
SearchApiSolrDateSortViewsQuery:: |
public | function |
@inheritdoc Overrides SearchApiViewsQuery:: |
|
SearchApiViewsQuery:: |
protected | property | Whether to abort the search instead of executing it. | |
SearchApiViewsQuery:: |
protected | property | Array of all encountered errors. | |
SearchApiViewsQuery:: |
protected | property | The names of all fields whose value is required by a handler. | |
SearchApiViewsQuery:: |
protected | property | The query's sub-filters representing the different Views filter groups. | |
SearchApiViewsQuery:: |
public | property | The conjunction with which multiple filter groups are combined. | |
SearchApiViewsQuery:: |
protected | property | The index this view accesses. | |
SearchApiViewsQuery:: |
protected | property | Number of results to display. | |
SearchApiViewsQuery:: |
protected | property | Offset of first displayed result. | |
SearchApiViewsQuery:: |
protected | property | The query that will be executed. | |
SearchApiViewsQuery:: |
protected | property | The results returned by the query, after it was executed. | |
SearchApiViewsQuery:: |
public | function | Aborts this search query. | |
SearchApiViewsQuery:: |
public | function | Add a field that should be retrieved from the results by this view. | |
SearchApiViewsQuery:: |
protected | function | Helper function for adding results to a view in the format expected by the view. | |
SearchApiViewsQuery:: |
public | function | Provides a sorting method as present in the Views default query plugin. | |
SearchApiViewsQuery:: |
public | function | Adds a sort to the query. | |
SearchApiViewsQuery:: |
public | function |
Let modules modify the query just prior to finalizing it. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
public | function |
Builds the necessary info to execute the query. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
public | function | Set a condition on the search query object. | |
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function |
Executes the query and fills the associated view object with according
values. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
protected | function | Helper function for extracting all necessary fields from a result item. | |
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | Adds a nested filter to the search query object. | |
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | API function for accessing the raw Search API query object. | |
SearchApiViewsQuery:: |
public | function | API function for accessing the raw Search API results. | |
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function |
Returns the according entity objects for the given query results. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
public | function |
Create the basic query object and fill with default values. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function |
Add settings for the UI. Overrides views_plugin_query:: |
|
SearchApiViewsQuery:: |
public | function |
Defines the options used by this query plugin. Overrides views_object:: |
|
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
SearchApiViewsQuery:: |
public | function | ||
views_object:: |
public | property | Handler's definition. | |
views_object:: |
public | property | Except for displays, options for the object will be held here. | 1 |
views_object:: |
function | Collect this handler's option definition and alter them, ready for use. | ||
views_object:: |
public | function | Views handlers use a special construct function. | 4 |
views_object:: |
public | function | Destructor. | 2 |
views_object:: |
public | function | 1 | |
views_object:: |
public | function | ||
views_object:: |
public | function | Always exports the option, regardless of the default value. | |
views_object:: |
public | function | Set default options on this object. | 1 |
views_object:: |
public | function | Set default options. | |
views_object:: |
public | function | Let the handler know what its full definition is. | |
views_object:: |
public | function | Unpack options over our existing defaults, drilling down into arrays so that defaults don't get totally blown away. | |
views_object:: |
public | function | Unpack a single option definition. | |
views_object:: |
public | function | Unpacks each handler to store translatable texts. | |
views_object:: |
public | function | ||
views_plugin:: |
public | property | The current used views display. | |
views_plugin:: |
public | property | The plugin name of this plugin, for example table or full. | |
views_plugin:: |
public | property | The plugin type of this plugin, for example style or query. | |
views_plugin:: |
public | property |
The top object of a view. Overrides views_object:: |
1 |
views_plugin:: |
public | function | Provide a list of additional theme functions for the theme info page. | |
views_plugin:: |
public | function | Return the human readable name of the display. | |
views_plugin:: |
public | function | Provide a full list of possible theme templates used by this style. | |
views_plugin:: |
public | function | Validate that the plugin is correct and can be saved. | 3 |
views_plugin_query:: |
public | property | A pager plugin that should be provided by the display. | 1 |
views_plugin_query:: |
public | function | Add a signature to the query, if such a thing is feasible. | 1 |
views_plugin_query:: |
public | function | Get aggregation info for group by queries. | 1 |
views_plugin_query:: |
public | function |
Handle any special handling on the validate form. Overrides views_plugin:: |
1 |
views_plugin_query:: |
public | function |
Validate the options form. Overrides views_plugin:: |
|
views_plugin_query:: |
public | function |
Generate a query and a countquery from all of the information supplied
to the object. Overrides views_plugin:: |
1 |
views_plugin_query:: |
public | function | Render the pager, if necessary. | |
views_plugin_query:: |
public | function | Control how all WHERE and HAVING groups are put together. | |
views_plugin_query:: |
public | function | Set a LIMIT on the query, specifying a maximum number of results. | |
views_plugin_query:: |
public | function | Set an OFFSET on the query, specifying a number of results to skip | |
views_plugin_query:: |
public | function | Create a new grouping for the WHERE or HAVING clause. | |
views_plugin_query:: |
public | function |
Returns the summary of the settings in the display. Overrides views_plugin:: |