- Issue created by @mkalkbrenner
- 🇩🇪Germany mkalkbrenner 🇩🇪
We just applied that patch to our production systems and it increased the speed of search result views.
- 🇦🇹Austria drunken monkey Vienna, Austria
drunken monkey → made their first commit to this issue’s fork.
- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for creating this MR, and sorry it took me a while to get back to you.
If the necessary values are available it is of course important to avoid unnecessary entity loads.However, I’m not sure that your code is completely generic. Does it also work if you take the code from
\Drupal\search_api\Plugin\views\field\SearchApiFieldTrait::query()
and use$this->definition['search_api field']
instead of$this->field
? (And sendNULL
if it doesn’t exist.)
I’ve pushed an update to your MR, please check it out.I think your current code will not work in case of Views field ID conflicts (or renames) and will also incorrectly pass a
$field_id
for fields that aren’t even indexed (though that will usually not cause any harm, at least with the Solr backend).