mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-22 04:23:01 +00:00
Bugfix: Don't throw a warning if the search index doesn't exist yet
This commit is contained in:
parent
21bba710b5
commit
c177b66b42
2 changed files with 8 additions and 2 deletions
|
@ -7,6 +7,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed double-escaping of rendered HTML when nesting templates
|
- Fixed double-escaping of rendered HTML when nesting templates
|
||||||
|
- Squashed a warning if the search index doesn't exist yet
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.
|
- [Module API] Added new extra data system. See `parser-parsedown` and `page-edit` for an example.
|
||||||
|
|
|
@ -483,6 +483,7 @@ class search
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Words that we should exclude from the inverted index
|
* Words that we should exclude from the inverted index
|
||||||
|
* @var string[]
|
||||||
*/
|
*/
|
||||||
public static $stop_words = [
|
public static $stop_words = [
|
||||||
"a", "about", "above", "above", "across", "after", "afterwards", "again",
|
"a", "about", "above", "above", "across", "after", "afterwards", "again",
|
||||||
|
@ -562,7 +563,7 @@ class search
|
||||||
/**
|
/**
|
||||||
* Converts a source string into a series of raw tokens.
|
* Converts a source string into a series of raw tokens.
|
||||||
* @param string $source The source string to process.
|
* @param string $source The source string to process.
|
||||||
* @param boolean $capture_offsets Whether to capture & return the character offsets of the tokens detected. If true, then each token returned will be an array in the form [ token, char_offset ].
|
* @param bool $capture_offsets Whether to capture & return the character offsets of the tokens detected. If true, then each token returned will be an array in the form [ token, char_offset ].
|
||||||
* @return array An array of raw tokens extracted from the specified source string.
|
* @return array An array of raw tokens extracted from the specified source string.
|
||||||
*/
|
*/
|
||||||
public static function tokenize($source, $capture_offsets = false)
|
public static function tokenize($source, $capture_offsets = false)
|
||||||
|
@ -690,13 +691,17 @@ class search
|
||||||
/**
|
/**
|
||||||
* Reads in and parses an inverted index, measuring the time it takes to do so.
|
* Reads in and parses an inverted index, measuring the time it takes to do so.
|
||||||
* @param string $invindex_filename The path to the file inverted index to parse.
|
* @param string $invindex_filename The path to the file inverted index to parse.
|
||||||
|
* @return boolean Whether the measurement was actually able to take place. Usually this will be true, but it will return false if it can't find the specified index.
|
||||||
*/
|
*/
|
||||||
public static function measure_invindex_load_time($invindex_filename) {
|
public static function measure_invindex_load_time($invindex_filename) {
|
||||||
global $env;
|
global $env;
|
||||||
|
if(!file_exists($invindex_filename))
|
||||||
|
return false;
|
||||||
$searchindex_decode_start = microtime(true);
|
$searchindex_decode_start = microtime(true);
|
||||||
search::load_invindex($invindex_filename);
|
search::load_invindex($invindex_filename);
|
||||||
$env->perfdata->searchindex_decode_time = round((microtime(true) - $searchindex_decode_start)*1000, 3);
|
$env->perfdata->searchindex_decode_time = round((microtime(true) - $searchindex_decode_start)*1000, 3);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue