diff --git a/config/schema/search_api.views.schema.yml b/config/schema/search_api.views.schema.yml index f2472ac..d5c8bb6 100644 --- a/config/schema/search_api.views.schema.yml +++ b/config/schema/search_api.views.schema.yml @@ -5,6 +5,9 @@ views.query.search_api_query: search_api_bypass_access: type: boolean label: If the underlying search index has access checks enabled, this option allows you to disable them for this view. + entity_access: + type: boolean + label: Execute an access check for all result items and all displayed entities. parse_mode: type: string label: Chooses how the search keys will be parsed. diff --git a/search_api.views.inc b/search_api.views.inc index 7dd35b1..0760ea8 100644 --- a/search_api.views.inc +++ b/search_api.views.inc @@ -27,10 +27,9 @@ use Drupal\search_api\Utility; * relationship handlers for each property of the datasource. Those will be * joined to the index base table by default. * - * Also, for each entity type that appears as the target entity type of an - * entity reference property in any datasource (or in any entity type thus - * reached), a table with field/relationship handlers for all of the entity - * type's properties. Those tables will use the key "search_api_entity_ENTITY". + * Also, for each entity type encountered in any table, a table with + * field/relationship handlers for all of that entity type's properties is + * created. Those tables will use the key "search_api_entity_ENTITY". */ function search_api_views_data() { $data = array(); @@ -674,8 +673,7 @@ function _search_api_views_get_field_handler_for_property(DataDefinitionInterfac $slashes = array_fill(0, count($parts), '/'); $parts = array_map('preg_quote', $parts, $slashes); // Use the "S" modifier for closer analysis of the pattern, since it - // might be executed a lot. (The docs say this won't get us anything in - // our case, but this might change, or be different, e.g., in HHVM.) + // might be executed a lot. $regex = '/^' . implode('.*', $parts) . '$/S'; $mappings['regex'][$regex] = $definition; } diff --git a/src/Plugin/views/field/SearchApiFieldTrait.php b/src/Plugin/views/field/SearchApiFieldTrait.php index 596ec68..7a5aac0 100644 --- a/src/Plugin/views/field/SearchApiFieldTrait.php +++ b/src/Plugin/views/field/SearchApiFieldTrait.php @@ -234,7 +234,8 @@ trait SearchApiFieldTrait { // the same type from different properties). // @todo Also, this will unnecessarily load items/entities even if all // required fields are provided in the results. However, to solve this, - // expandRequiredProperties() would have to + // expandRequiredProperties() would have to provide more information, or + // provide a separate properties list for each row. $required_properties = $this->expandRequiredProperties(); /** @var \Drupal\Core\TypedData\ComplexDataDefinitionInterface[] $data_definitions */ $data_definitions = array(); @@ -436,7 +437,7 @@ trait SearchApiFieldTrait { $property_path = $this->getCombinedPropertyPath(); if (!empty($values->{$property_path})) { // Although it's undocumented, the field handler base class assumes items - // will always be arrays. + // will always be arrays. See #2648012 for documenting this. $items = array(); foreach ((array) $values->{$property_path} as $i => $value) { $item = array( diff --git a/src/Tests/ViewsTest.php b/src/Tests/ViewsTest.php index 40befe4..978d085 100644 --- a/src/Tests/ViewsTest.php +++ b/src/Tests/ViewsTest.php @@ -195,6 +195,7 @@ class ViewsTest extends WebTestBase { $this->insertExampleContent(); $this->drupalGet('admin/structure/views/view/search_api_test_views_fulltext'); + $this->assertResponse(200); } }