Overview
Comment:Limiter la longueur du champ de recherche
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA1: 0277842dc6524a6f6fb0657e66273bfe8c54e917
User & Date: bohwaz on 2020-09-08 18:53:40
Other Links: manifest | tags
Context
2020-10-26
20:45
Merge back changes from trunk check-in: 13b04f66ad user: bohwaz tags: dev
2020-09-08
18:53
Limiter la longueur du champ de recherche Leaf check-in: 0277842dc6 user: bohwaz tags: trunk, stable
18:42
Fix: erreur quand le fichier de fond d'écran a déjà été supprimé (race condition) check-in: 41baaae90b user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Wiki.php from [a63e6d83d2] to [640f809bb6].

285
286
287
288
289
290
291




292
293
294
295
296
297
298
        ], 'id = :id', ['id' => (int)$id]);

        return true;
    }

    public function search($search)
    {




        $query = sprintf('SELECT
            p.uri, r.*, snippet(wiki_recherche, \'<b>\', \'</b>\', \'...\', -1, -50) AS snippet,
            rank(matchinfo(wiki_recherche), 0, 1.0, 1.0) AS points
            FROM wiki_recherche AS r INNER JOIN wiki_pages AS p ON p.id = r.id
            WHERE %s AND wiki_recherche MATCH ?
            ORDER BY points DESC LIMIT 0,50;', $this->_getLectureClause('p.'));








>
>
>
>







285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
        ], 'id = :id', ['id' => (int)$id]);

        return true;
    }

    public function search($search)
    {
        if (strlen($search) > 100) {
            throw new UserException('Recherche trop longue : maximum 100 caractères');
        }

        $query = sprintf('SELECT
            p.uri, r.*, snippet(wiki_recherche, \'<b>\', \'</b>\', \'...\', -1, -50) AS snippet,
            rank(matchinfo(wiki_recherche), 0, 1.0, 1.0) AS points
            FROM wiki_recherche AS r INNER JOIN wiki_pages AS p ON p.id = r.id
            WHERE %s AND wiki_recherche MATCH ?
            ORDER BY points DESC LIMIT 0,50;', $this->_getLectureClause('p.'));