improve handling of multi-word partials in SearchDescription

Multi-word partial terms had an undue advantage over separate partial
terms because they only need to pay the penalty once. This changes
the behaviour by setting the penalty according to the number of
words in the token. This should get rid of search interpretations
with low chance of matching.

This also fixes handling of exact term matching. We now match against
all exact terms of the query, not just a couple of them collected
while building the interpretations.

Also adds a penalty to very short postcodes.
This commit is contained in:
Sarah Hoffmann
2020-11-25 11:44:25 +01:00
parent f21853ea9d
commit 0f87da017f
6 changed files with 50 additions and 15 deletions

View File

@@ -650,6 +650,8 @@ class Geocode
$this->oNormalizer
);
$oCtx->setFullNameWords($oValidTokens->getFullWordIDs());
// Try more interpretations for Tokens that could not be matched.
foreach ($aTokens as $sToken) {
if ($sToken[0] == ' ' && !$oValidTokens->contains($sToken)) {