mirror of
https://github.com/osm-search/Nominatim.git
synced 2024-09-19 23:17:21 +03:00
switch housenumber tokens to new word table layout
This commit is contained in:
parent
1618aba5f2
commit
5ab0a63fd6
@ -156,6 +156,8 @@ class Tokenizer
|
||||
$aDBWords = $this->oDB->getAll($sSQL, null, 'Could not get word tokens.');
|
||||
|
||||
foreach ($aDBWords as $aWord) {
|
||||
$iId = (int) $aWord['word_id'];
|
||||
|
||||
switch ($aWord['type']) {
|
||||
'C': // country name tokens
|
||||
if ($aWord['country'] === null
|
||||
@ -166,12 +168,13 @@ class Tokenizer
|
||||
}
|
||||
$oToken = new Token\Country($iId, $aWord['country'])
|
||||
break;
|
||||
'H': // house number tokens
|
||||
$oToken = new Token\HouseNumber($iId, $aWord['word_token']);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
/* $iId = (int) $aWord['word_id'];
|
||||
|
||||
if ($aWord['class']) {
|
||||
/* if ($aWord['class']) {
|
||||
// Special terms need to appear in their normalized form.
|
||||
// (postcodes are not normalized in the word table)
|
||||
$sNormWord = $this->normalizeString($aWord['word']);
|
||||
|
@ -140,15 +140,13 @@ CREATE OR REPLACE FUNCTION getorcreate_hnr_id(lookup_term TEXT)
|
||||
DECLARE
|
||||
return_id INTEGER;
|
||||
BEGIN
|
||||
SELECT min(word_id) INTO return_id
|
||||
FROM word
|
||||
WHERE word_token = ' ' || lookup_term
|
||||
and class = 'place' and type = 'house';
|
||||
SELECT min(word_id) INTO return_id FROM word
|
||||
WHERE word_token = lookup_term and type = 'H';
|
||||
|
||||
IF return_id IS NULL THEN
|
||||
return_id := nextval('seq_word');
|
||||
INSERT INTO word (word_id, word_token, class, type, search_name_count)
|
||||
VALUES (return_id, ' ' || lookup_term, 'place', 'house', 0);
|
||||
INSERT INTO word (word_id, word_token, type)
|
||||
VALUES (return_id, lookup_term, 'H');
|
||||
END IF;
|
||||
|
||||
RETURN return_id;
|
||||
|
@ -601,7 +601,8 @@ class _TokenCache:
|
||||
|
||||
def get_hnr_tokens(self, conn, terms):
|
||||
""" Get token ids for a list of housenumbers, looking them up in the
|
||||
database if necessary.
|
||||
database if necessary. `terms` is an iterable of normalized
|
||||
housenumbers.
|
||||
"""
|
||||
tokens = []
|
||||
askdb = []
|
||||
|
Loading…
Reference in New Issue
Block a user