Bugfix
This commit is contained in:
@@ -90,7 +90,7 @@ Contao 5 – Frontend Module Template
|
|||||||
cropLength: 50,
|
cropLength: 50,
|
||||||
cropMarker: '…',
|
cropMarker: '…',
|
||||||
|
|
||||||
sort: ['priority:desc']
|
sort: ['startDate:asc', 'priority:desc']
|
||||||
});
|
});
|
||||||
|
|
||||||
renderResults(response.hits);
|
renderResults(response.hits);
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ class MeilisearchIndexService
|
|||||||
],
|
],
|
||||||
'sortableAttributes' => [
|
'sortableAttributes' => [
|
||||||
'priority',
|
'priority',
|
||||||
|
'startDate',
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
@@ -94,11 +95,25 @@ class MeilisearchIndexService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$indexPastEvents = (bool) Config::get('meilisearch_index_past_events');
|
||||||
|
$today = strtotime('today');
|
||||||
|
|
||||||
$documents = [];
|
$documents = [];
|
||||||
|
|
||||||
foreach ($rows as $row) {
|
foreach ($rows as $row) {
|
||||||
$type = $this->detectTypeFromMeta($row['meta'] ?? null);
|
$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 = [
|
$doc = [
|
||||||
'id' => $type . '_' . $row['id'],
|
'id' => $type . '_' . $row['id'],
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
@@ -111,7 +126,12 @@ class MeilisearchIndexService
|
|||||||
'priority' => (int) ($row['priority'] ?? 0),
|
'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'])) {
|
if (!empty($row['imagepath'])) {
|
||||||
$imagePath = $this->imageHelper->resolveImagePath($row['imagepath']);
|
$imagePath = $this->imageHelper->resolveImagePath($row['imagepath']);
|
||||||
if ($imagePath !== null) {
|
if ($imagePath !== null) {
|
||||||
@@ -122,7 +142,9 @@ class MeilisearchIndexService
|
|||||||
$documents[] = $doc;
|
$documents[] = $doc;
|
||||||
}
|
}
|
||||||
|
|
||||||
$index->addDocuments($documents);
|
if ($documents !== []) {
|
||||||
|
$index->addDocuments($documents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function indexTlSearchPdf(Indexes $index): void
|
private function indexTlSearchPdf(Indexes $index): void
|
||||||
|
|||||||
Reference in New Issue
Block a user