Do not force item loads

Created on 2 March 2023, over 1 year ago

Currently, _searchstax_add_tracking() will call $item->getOriginalObject() without $load = FALSE, forcing an item load on pages that otherwise wouldn’t need them. We should probably avoid doing that.

The code in question needs the loaded item in order to track the document title (not really necessary), and to obtain the URL for the purpose of click tracking. The latter could, of course, be considered important enough to warrant loading the items, so maybe making this configurable would be the better option. (On the other hand, if the item has not been loaded at that point, its URL doesn’t seem to have been used in creating the displayed search results, so there’s a chance that click tracking will not work anyways, due to a mismatch in URLs.)

In any case, if we decide we want to load the items, if necessary, we should at least be smarter about it and load them as a single batch, not one at a time.

🐛 Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

🇦🇹Austria drunken monkey Vienna, Austria

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024