Skip to content

Commit 2d63b4b

Browse files
committed
Fixed typo of missing domain_id and order of commands.
1 parent 70da302 commit 2d63b4b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

web/websearch.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,19 @@
3333
raise Exception('Missing required environment variable DOMAINS!')
3434
sys.exit(1)
3535

36+
37+
def get_domain_id(domain):
38+
# Remove unexpected characters: .:/-,
39+
return domain.replace('.', '').replace(':', '').replace('/', '').replace('-', '').replace(',', '')
40+
41+
3642
# Split domains by comma and prepare source/index for this domain:
3743
# Input data /data/<domain>/search.tsv
3844
# Prepare domain IDs
3945
domains = domains.split(',')
4046
domain_ids = {}
4147
for domain in domains:
48+
domain_id = get_domain_id(domain)
4249
# Check uniqueness and skip duplicates
4350
if domain_id in domain_ids.values():
4451
continue
@@ -54,11 +61,6 @@
5461
SEARCH_DEFAULT_COUNT = int(getenv('SEARCH_DEFAULT_COUNT'))
5562

5663

57-
def get_domain_id(domain):
58-
# Remove unexpected characters: .:/-,
59-
return domain.replace('.', '').replace(':', '').replace('/', '').replace('-', '').replace(',', '')
60-
61-
6264
# ---------------------------------------------------------
6365
"""
6466
Process query to Sphinx searchd

0 commit comments

Comments
 (0)