This commit is contained in:
Jürgen Mummert
2025-12-27 20:16:52 +01:00
parent cfffdf2323
commit 131e24fe2e
2 changed files with 25 additions and 3 deletions
+24 -2
View File
@@ -83,6 +83,7 @@ class MeilisearchIndexService
],
'sortableAttributes' => [
'priority',
'startDate',
],
]);
}
@@ -94,11 +95,25 @@ class MeilisearchIndexService
return;
}
$indexPastEvents = (bool) Config::get('meilisearch_index_past_events');
$today = strtotime('today');
$documents = [];
foreach ($rows as $row) {
$type = $this->detectTypeFromMeta($row['meta'] ?? null);
// 🛑 VERGANGENE EVENTS FILTERN
if ($type === 'event' && !$indexPastEvents) {
if (!empty($row['startDate'])) {
$eventStart = (int) $row['startDate'];
if ($eventStart < $today) {
continue; // ⛔ Event überspringen
}
}
}
$doc = [
'id' => $type . '_' . $row['id'],
'type' => $type,
@@ -111,7 +126,12 @@ class MeilisearchIndexService
'priority' => (int) ($row['priority'] ?? 0),
];
// ✅ Bild aus UUID erzeugen (falls vorhanden)
// 📅 startDate nur für Events übernehmen
if ($type === 'event' && !empty($row['startDate'])) {
$doc['startDate'] = (int) $row['startDate'];
}
// 🖼️ Bild aus UUID erzeugen
if (!empty($row['imagepath'])) {
$imagePath = $this->imageHelper->resolveImagePath($row['imagepath']);
if ($imagePath !== null) {
@@ -122,7 +142,9 @@ class MeilisearchIndexService
$documents[] = $doc;
}
$index->addDocuments($documents);
if ($documents !== []) {
$index->addDocuments($documents);
}
}
private function indexTlSearchPdf(Indexes $index): void