Add Index Listener
This commit is contained in:
@@ -9,27 +9,29 @@ class MeilisearchEventMarkerListener
|
||||
{
|
||||
public function onParseTemplate(Template $template): void
|
||||
{
|
||||
// DEBUG: Immer sichtbar, sobald parseTemplate überhaupt läuft
|
||||
$GLOBALS['MEILISEARCH_MARKERS']['event']['debug_hook'] = 'parseTemplate_called:' . $template->getName();
|
||||
|
||||
if ($template->getName() !== 'mod_eventreader') {
|
||||
return;
|
||||
}
|
||||
|
||||
// DEBUG: Was ist im Template vorhanden?
|
||||
$GLOBALS['MEILISEARCH_MARKERS']['event']['debug_has_event_prop'] = isset($template->event) ? 'yes' : 'no';
|
||||
|
||||
if (!isset($template->event) || !$template->event instanceof CalendarEventsModel) {
|
||||
// 🔥 Event-Detailseite erkennen
|
||||
if (
|
||||
!isset($template->event) ||
|
||||
!$template->event instanceof CalendarEventsModel
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
$event = $template->event;
|
||||
|
||||
$priority = (int) ($event->priority ?? 0);
|
||||
$keywords = trim((string) ($event->keywords ?? ''));
|
||||
|
||||
if ($priority <= 0 && $keywords === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
// ✅ Marker setzen (merge-sicher)
|
||||
$GLOBALS['MEILISEARCH_MARKERS']['event'] = array_merge(
|
||||
$GLOBALS['MEILISEARCH_MARKERS']['event'] ?? [],
|
||||
[
|
||||
'priority' => (int) ($event->priority ?? 0),
|
||||
'keywords' => trim((string) ($event->keywords ?? '')),
|
||||
'priority' => $priority > 0 ? $priority : null,
|
||||
'keywords' => $keywords !== '' ? $keywords : null,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user