mirror of
https://github.com/matrix-org/matrix-spec
synced 2026-06-17 05:17:48 +02:00
Rank changelog results to the very bottom
Signed-off-by: Johannes Marbach <n0-0ne+github@mailbox.org>
This commit is contained in:
parent
5fa9103ae5
commit
78ab248a0b
|
|
@ -132,18 +132,26 @@ search backend.
|
||||||
// Kick off the search, load the results and inject them into the popover.
|
// Kick off the search, load the results and inject them into the popover.
|
||||||
//
|
//
|
||||||
|
|
||||||
const search = await pagefind.debouncedSearch(searchQuery);
|
// First search all non-changelog pages.
|
||||||
|
const search = await pagefind.debouncedSearch(searchQuery, { filters: { not: { type: "changelog" } } });
|
||||||
if (search === null) {
|
if (search === null) {
|
||||||
// A more recent search call has been made, nothing to do.
|
// A more recent search call has been made, nothing to do.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (search.results.length === 0) {
|
// Now search the changelog pages and append any results so that changelog
|
||||||
|
// results are ranked lowest. We cannot use Pagefind's sorting to do this
|
||||||
|
// because that would override the default ranking within the non-changelog
|
||||||
|
// results
|
||||||
|
const changelogSearch = await pagefind.search(searchQuery, { filters: { type: "changelog" } });
|
||||||
|
const results = [...search.results, ...changelogSearch.results];
|
||||||
|
|
||||||
|
if (results.length === 0) {
|
||||||
$searchResultBody.append(
|
$searchResultBody.append(
|
||||||
$("<p>").text(`No results found for query "${searchQuery}"`)
|
$("<p>").text(`No results found for query "${searchQuery}"`)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
await loadAndRenderResults(search.results, 0, $spinner, $searchResultBody);
|
await loadAndRenderResults(results, 0, $spinner, $searchResultBody);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
{{ $version := lower .LinkTitle -}}
|
{{ $version := lower .LinkTitle -}}
|
||||||
<div class="td-content">
|
<div class="td-content" data-pagefind-filter="type:changelog">
|
||||||
<h1>{{ .Title }}</h1>
|
<h1>{{ .Title }}</h1>
|
||||||
|
|
||||||
<table class="release-info">
|
<table class="release-info">
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue