[wgem] begin: reading from index

This commit is contained in:
Vinícius Moreira
2019-12-16 20:01:09 -03:00
parent e73e36b9c2
commit ab043cc318
2 changed files with 27 additions and 9 deletions

View File

@@ -40,16 +40,15 @@ class SearchIndexGenerator:
name = sug.get('name')
if name:
split_name = name.split(' ')
split_name = name.lower().strip().split(' ')
single_name = ''.join(split_name)
for word in (*split_name, single_name):
word_key = word.lower().strip()
mapped = index.get(word_key)
mapped = index.get(word)
if not mapped:
mapped = set()
index[word_key] = mapped
index[word] = mapped
mapped.add(key)