1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-26 02:55:02 +00:00

search: squash file_get_contents warning, but more insight is needed. closes #193.

This commit is contained in:
Starbeamrainbowlabs 2020-07-10 23:22:30 +01:00
parent b4e4094451
commit 86216fd4c1
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 7 additions and 1 deletions

View file

@ -43,6 +43,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Squashed the text `\A` appearing before tags at the bottom of pages for some users ([ref](https://gitter.im/Pepperminty-Wiki/Lobby?at=5f0632068342f4627401f145))
- Fixed an issue causing uploaded avatars not to render
- Fixed an obscure bug in the search engine when excluding terms that appear both in a page's title and body
- Squashed a warning at the top of search results (more insight is needed though to squash the inconsistencies in the search index that creep in though)
## v0.21.1-hotfix1

View file

@ -151,10 +151,15 @@ register_module([
$start = microtime(true);
foreach($results as &$result) {
$filepath = $env->storage_prefix . $result["pagename"] . ".md";
if(!file_exists($filepath)) {
error_log("[pepperminty wiki/$settings->sitename/search] Search engine returned {$result["pagename"]} as a result (maps to $filepath), but it doesn't exist on disk (try rebuilding the search index).");
continue; // Something strange is happening
}
$result["context"] = search::extract_context(
$result["pagename"],
$query_parsed,
file_get_contents($env->storage_prefix . $result["pagename"] . ".md")
file_get_contents()
);
}
$env->perfdata->context_generation_time = round((microtime(true) - $start)*1000, 3);