trait TaxonomyIndexDepthQueryTrait (View source)

Builds a performant depth subquery and adds it as a join to the query.

This is performant because:

  • It creates multiple queries on taxonomy_index with inner joins to taxonomy_term__parent. These queries are combined together into a subquery using unions to select all the node IDs with the terms in the hierarchy.
  • It joins the resulting query to the main views query using an INNER JOIN.

For example, if the $tids value is '718' and depth is configured to 2, the resulting JOIN to node_field_data will be:

Methods

void
addSubQueryJoin(string|array $tids)

Builds a performant depth subquery and adds it as a join to the query.

Details

protected void addSubQueryJoin(string|array $tids)

Builds a performant depth subquery and adds it as a join to the query.

Parameters

string|array $tids

The terms ID(s) to do a depth search for.

Return Value

void