Skip to content

Commit

Permalink
Fixed typo of missing domain_id and order of commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinMikita committed May 12, 2018
1 parent 70da302 commit 2d63b4b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions web/websearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,19 @@
raise Exception('Missing required environment variable DOMAINS!')
sys.exit(1)


def get_domain_id(domain):
# Remove unexpected characters: .:/-,
return domain.replace('.', '').replace(':', '').replace('/', '').replace('-', '').replace(',', '')


# Split domains by comma and prepare source/index for this domain:
# Input data /data/<domain>/search.tsv
# Prepare domain IDs
domains = domains.split(',')
domain_ids = {}
for domain in domains:
domain_id = get_domain_id(domain)
# Check uniqueness and skip duplicates
if domain_id in domain_ids.values():
continue
Expand All @@ -54,11 +61,6 @@
SEARCH_DEFAULT_COUNT = int(getenv('SEARCH_DEFAULT_COUNT'))


def get_domain_id(domain):
# Remove unexpected characters: .:/-,
return domain.replace('.', '').replace(':', '').replace('/', '').replace('-', '').replace(',', '')


# ---------------------------------------------------------
"""
Process query to Sphinx searchd
Expand Down

0 comments on commit 2d63b4b

Please sign in to comment.