Skip to content

Remove pyhash part because of compilation failure on Heroku #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pytest = "==3.10.0"
requests-iap = "==0.2.0"
python-helpscout-v2 = "==1.0.1"
meilisearch = "*"
pyhash = "*"
# pyhash = "*"

[dev-packages]
pylint = "==2.3.1"
Expand Down
13 changes: 1 addition & 12 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions scraper/src/meilisearch_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
import meilisearch
from builtins import range
import pyhash
# import pyhash

def remove_bad_encoding(value):
return value.replace(''', "'")
Expand Down Expand Up @@ -37,16 +37,17 @@ def parse_record(record):
for k, v in record['hierarchy_radio'].items():
key = 'hierarchy_radio_' + k
new_hierarchy_radio = {**{key: v}, **new_hierarchy_radio}
hasher = pyhash.fnv1_32()
new_record_url_hash = {}
new_record_url_hash['url_hash'] = hasher(record['url'])
# hasher = pyhash.fnv1_32()
# new_record_url_hash = {}
# new_record_url_hash['url_hash'] = hasher(record['url'])
del record['weight']
del record['hierarchy']
del record['hierarchy_radio']
del record['hierarchy_camel']
del record['hierarchy_radio_camel']
del record['content_camel']
return {**record, **new_weight, **new_hierarchy, **new_hierarchy_radio, **new_record_url_hash}
return {**record, **new_weight, **new_hierarchy, **new_hierarchy_radio}
# return {**record, **new_weight, **new_hierarchy, **new_hierarchy_radio, **new_record_url_hash}

class MeiliSearchHelper:
"""MeiliSearchHelper"""
Expand All @@ -63,7 +64,7 @@ class MeiliSearchHelper:
"level",
"position"
],
"distinctField": "url_hash",
# "distinctField": "url_hash",
"rankingRules": {
"page_rank": "dsc",
"level": "dsc",
Expand Down Expand Up @@ -105,7 +106,7 @@ def update_schema_based_on(self, record):
base_schema = {
'anchor': ['displayed'],
'url': ['displayed'],
'url_hash': ['displayed', 'ranked'],
# 'url_hash': ['displayed', 'ranked'],
'content': ['indexed', 'displayed'],
'objectID': ['identifier', 'indexed', 'displayed'],
'page_rank': ['indexed', 'ranked'],
Expand Down