Search/Indexing
* add reversed words and update token processing to allow fulltext search to match end of word (e.g. searching 'wind -storm' will now find 'whisperwind' or 'windrunner' and ignore 'stormwind') * fix search token duplication for spells
This commit is contained in:
parent
764ea1c7fa
commit
681d29e5f3
5 changed files with 22 additions and 6 deletions
1
setup/sql/updates/1774728772_01.sql
Normal file
1
setup/sql/updates/1774728772_01.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' search');
|
||||
|
|
@ -289,9 +289,9 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
|||
$buff = self::normalize(str_replace('<br />', ' ', $_));
|
||||
}
|
||||
|
||||
if ($_ = $desc ?: Util::localizedString($spell, 'description', true))
|
||||
if (!$desc && ($_ = Util::localizedString($spell, 'description', true)))
|
||||
$desc = self::normalize($_);
|
||||
if ($_ = $buff ?: Util::localizedString($spell, 'buff', true))
|
||||
if (!$buff && ($_ = Util::localizedString($spell, 'buff', true)))
|
||||
$buff = self::normalize($_);
|
||||
if ($_ = Util::localizedString($spell, 'name', true))
|
||||
$name = self::normalize($_);
|
||||
|
|
@ -321,7 +321,7 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
|||
$row[$key] = self::normalize($row[$key] ?? '');
|
||||
}
|
||||
|
||||
// e.g. "Zul'Aman O'Reilly" => "Zul Aman ZulAman OReilly Reilly"
|
||||
// e.g. "Zul'Aman O'Reilly" => "Zul Aman ZulAman OReilly Reilly luZ namA luZnamA yllieRO yllieR"
|
||||
private static function normalize(?string $words) : ?string
|
||||
{
|
||||
if (!$words)
|
||||
|
|
@ -351,7 +351,13 @@ CLISetup::registerSetup("sql", new class extends SetupScript
|
|||
$result[] = $word;
|
||||
}
|
||||
|
||||
return $result ? implode(' ', array_unique($result)) : null;
|
||||
if (!$result)
|
||||
return null;
|
||||
|
||||
$result = array_unique($result);
|
||||
$reversed = array_map(Util::strrev(...), $result);
|
||||
|
||||
return implode(' ', array_merge($result, $reversed));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue