mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-09-25 01:53:03 +02:00
Add SQLite indexes for contenus page language/tag queries + WIP: Peertube orphans, dialogs, contact decoupling, context note, finality types
This commit is contained in:
+16
-7
@@ -1297,9 +1297,10 @@ class Database
|
||||
if ($query === '') {
|
||||
$stmt = $this->pdo->query('
|
||||
SELECT tg.id, tg.name,
|
||||
COUNT(DISTINCT tt.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM tags tg
|
||||
LEFT JOIN thesis_tags tt ON tg.id = tt.tag_id
|
||||
LEFT JOIN theses t ON tt.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE tg.deleted_at IS NULL
|
||||
GROUP BY tg.id
|
||||
ORDER BY thesis_count DESC, tg.name COLLATE NOCASE
|
||||
@@ -1308,9 +1309,10 @@ class Database
|
||||
} else {
|
||||
$stmt = $this->pdo->prepare('
|
||||
SELECT tg.id, tg.name,
|
||||
COUNT(DISTINCT tt.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM tags tg
|
||||
LEFT JOIN thesis_tags tt ON tg.id = tt.tag_id
|
||||
LEFT JOIN theses t ON tt.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE tg.name LIKE ? AND tg.deleted_at IS NULL
|
||||
GROUP BY tg.id
|
||||
ORDER BY tg.name = ? DESC, thesis_count DESC, tg.name COLLATE NOCASE
|
||||
@@ -1328,9 +1330,10 @@ class Database
|
||||
{
|
||||
$stmt = $this->pdo->query('
|
||||
SELECT tg.id, tg.name,
|
||||
COUNT(DISTINCT tt.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM tags tg
|
||||
LEFT JOIN thesis_tags tt ON tg.id = tt.tag_id
|
||||
LEFT JOIN theses t ON tt.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE tg.deleted_at IS NULL
|
||||
GROUP BY tg.id
|
||||
ORDER BY tg.name COLLATE NOCASE
|
||||
@@ -1416,9 +1419,10 @@ class Database
|
||||
$stmt = $this->pdo->query('
|
||||
SELECT MIN(l.id) as id,
|
||||
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
|
||||
COUNT(DISTINCT tl.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM languages l
|
||||
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
|
||||
LEFT JOIN theses t ON tl.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE l.deleted_at IS NULL
|
||||
GROUP BY LOWER(l.name)
|
||||
ORDER BY thesis_count DESC, LOWER(MIN(l.name)) COLLATE NOCASE
|
||||
@@ -1428,9 +1432,10 @@ class Database
|
||||
$stmt = $this->pdo->prepare('
|
||||
SELECT MIN(l.id) as id,
|
||||
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
|
||||
COUNT(DISTINCT tl.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM languages l
|
||||
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
|
||||
LEFT JOIN theses t ON tl.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE LOWER(l.name) LIKE LOWER(?) AND l.deleted_at IS NULL
|
||||
GROUP BY LOWER(l.name)
|
||||
ORDER BY LOWER(MIN(l.name)) = LOWER(?) DESC, thesis_count DESC, LOWER(MIN(l.name)) COLLATE NOCASE
|
||||
@@ -1450,9 +1455,10 @@ class Database
|
||||
$stmt = $this->pdo->query('
|
||||
SELECT MIN(l.id) as id,
|
||||
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
|
||||
COUNT(DISTINCT tl.thesis_id) as thesis_count
|
||||
COUNT(DISTINCT t.id) as thesis_count
|
||||
FROM languages l
|
||||
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
|
||||
LEFT JOIN theses t ON tl.thesis_id = t.id AND t.deleted_at IS NULL
|
||||
WHERE l.deleted_at IS NULL
|
||||
GROUP BY LOWER(l.name)
|
||||
ORDER BY LOWER(MIN(l.name)) COLLATE NOCASE
|
||||
@@ -2683,7 +2689,10 @@ class Database
|
||||
t.context_note,
|
||||
t.remarks,
|
||||
t.jury_points,
|
||||
t.baiu_link
|
||||
t.baiu_link,
|
||||
t.exemplaire_baiu,
|
||||
t.exemplaire_erg,
|
||||
t.cc2r
|
||||
FROM theses t
|
||||
LEFT JOIN orientations o ON t.orientation_id = o.id
|
||||
LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id
|
||||
|
||||
Reference in New Issue
Block a user