Overview
Comment:Improve files search rendering
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | stable
Files: files | file ages | folders
SHA3-256: e63b3a552ff3806c001ca7c66959259128b268deedc288b8f4a436701dfff3d7
User & Date: bohwaz on 2022-07-12 21:17:32
Other Links: manifest | tags
Context
2022-07-12
21:44
Fix prefix in links check-in: 90f6a13cf1 user: bohwaz tags: trunk, stable
21:17
Improve files search rendering check-in: e63b3a552f user: bohwaz tags: trunk, stable
21:16
Web page: add checkInternalLinks method, fix existing pages renamed to lowercase when saving check-in: 7d9327ff42 user: bohwaz tags: trunk, stable
Changes

Modified src/include/lib/Garradin/Files/Files.php from [9196c1dfe3] to [0d745faabd].

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
			$where = ' AND path LIKE ?';
			$params[] = $path;
		}

		$query = sprintf('SELECT
			*,
			dirname(path) AS parent,
			snippet(files_search, \'<b>\', \'</b>\', \'…\', 2) AS snippet,
			rank(matchinfo(files_search), 0, 1.0, 1.0) AS points
			FROM files_search
			WHERE files_search MATCH ? %s
			ORDER BY points DESC
			LIMIT 0,50;', $where);

		return DB::getInstance()->get($query, ...$params);







|







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
			$where = ' AND path LIKE ?';
			$params[] = $path;
		}

		$query = sprintf('SELECT
			*,
			dirname(path) AS parent,
			snippet(files_search, \'<b>\', \'</b>\', \'…\', 2, -30) AS snippet,
			rank(matchinfo(files_search), 0, 1.0, 1.0) AS points
			FROM files_search
			WHERE files_search MATCH ? %s
			ORDER BY points DESC
			LIMIT 0,50;', $where);

		return DB::getInstance()->get($query, ...$params);

Modified src/templates/web/search.tpl from [8a727d1b73] to [9bf1c9de8a].

14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
	<p class="block alert">
		<strong>{$results_count}</strong> pages trouvées pour «&nbsp;{$query}&nbsp;»
	</p>

	<section class="search-results">
	{foreach from=$results item="result"}
		<article>

			<h4>
				<nav class="breadcrumbs">
					<ul>
						{foreach from=$result.breadcrumbs key="id" item="title"}
							<li><a href="{"!web/page.php?p=%s"|local_url|args:$id}" target="_parent">{$title}</a></li>
						{/foreach}
					</ul>
				</nav>
			</h4>
			<h3><a href="{"!web/page.php?p=%s"|local_url|args:$result.path}" target="_parent">{$result.title}</a></h3>
			<p>{$result.snippet|escape|clean_snippet}</p>
		</article>
	{/foreach}
	</section>
{/if}

{include file="admin/_foot.tpl"}







>









<







14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
	<p class="block alert">
		<strong>{$results_count}</strong> pages trouvées pour «&nbsp;{$query}&nbsp;»
	</p>

	<section class="search-results">
	{foreach from=$results item="result"}
		<article>
			<h3><a href="{"!web/page.php?p=%s"|local_url|args:$result.path}" target="_parent">{$result.title}</a></h3>
			<h4>
				<nav class="breadcrumbs">
					<ul>
						{foreach from=$result.breadcrumbs key="id" item="title"}
							<li><a href="{"!web/page.php?p=%s"|local_url|args:$id}" target="_parent">{$title}</a></li>
						{/foreach}
					</ul>
				</nav>
			</h4>

			<p>{$result.snippet|escape|clean_snippet}</p>
		</article>
	{/foreach}
	</section>
{/if}

{include file="admin/_foot.tpl"}

Modified src/www/admin/static/styles/02-common.css from [cc95968637] to [3a0208a85c].

473
474
475
476
477
478
479




480
481
482
483
484
485
486
    list-style-type: none;
    display: inline;
}

nav.breadcrumbs li:before {
    content: "> ";
}





nav.breadcrumbs li:last-child a {
    font-weight: bold;
}

nav.breadcrumbs aside {
    float: right;







>
>
>
>







473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
    list-style-type: none;
    display: inline;
}

nav.breadcrumbs li:before {
    content: "> ";
}

nav.breadcrumbs li:first-child:before {
    content: "";
}

nav.breadcrumbs li:last-child a {
    font-weight: bold;
}

nav.breadcrumbs aside {
    float: right;
528
529
530
531
532
533
534
535
536
537
538
539
540






.search-results h4 a {
    font-weight: normal !important;
    font-size: .9em;
    color: #999;
}

.search-results h3 {
    margin: .3em 0;
}

.search-results h3 a {
    font-weight: normal;
}













|





>
>
>
>
>
>
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
.search-results h4 a {
    font-weight: normal !important;
    font-size: .9em;
    color: #999;
}

.search-results h3 {
    margin: 0;
}

.search-results h3 a {
    font-weight: normal;
}

.search-results .breadcrumbs {
    margin: 0;
    font-size: .9em;
    margin-bottom: .8em;
}