Problem/Motivation

Looks like there are several locations in which SearchApiIndex->item_type still is used as entity type. Those usages should be replaced by SearchApiIndex->getEntityType() as item_type doesn't represent the entity type in all cases. (e.g. Search API ET / Search API Grouping)

Proposed resolution

Use SearchApiIndex->getEntityType() instead SearchApiIndex->item_type.

Remaining tasks

Reviews needed.

User interface changes

None.

API changes

None.

Comments

drunken monkey’s picture

Title: Fix usage of SearchApiIndex->item_type related to entities » Fix forgotten usages of $index->item_type
StatusFileSize
new1.29 KB

Thanks for creating this issue and providing a patch! You're right, seems we missed a few spots when changing this years ago.
However, only some of your suggested changes are actually valid, in some instances we still want to use item_type. Also, this

+++ b/contrib/search_api_views/includes/query.inc
@@ -169,7 +169,7 @@ class SearchApiViewsQuery extends views_plugin_query {
+    if (entity_get_info($this->index->getEntityType())) {

won't work as intended – if the index has no entity type, getEntityType() will return NULL and entity_get_info() will therefore return all entity infos, so the expression will always evaluate to TRUE.

So, attached is a revised version of the patch which should fix the problem. Please tell me if you think that's OK, or if you're certain one of your other changes is needed (and why).

drunken monkey’s picture

Status: Needs review » Fixed

OK, then, committed.
Thanks again for pointing these out!

  • drunken monkey committed 86eafb0 on 7.x-1.x
    Issue #2347367 by drunken monkey, das-peter: Fixed forgotten usages of $...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.