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