Skip to content

Commit a6c3eba

Browse files
authored
Merge pull request #174 from cul-it/hotfix/0.1.1
Hotfix/0.1.1
2 parents c58c2f8 + dc45bbd commit a6c3eba

File tree

19 files changed

+183
-66
lines changed

19 files changed

+183
-66
lines changed

Pipfile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "pypi"
77

88
[packages]
99

10-
arxiv-base = "==0.5.1"
10+
arxiv-base = "==0.6.1"
1111
boto = "==2.48.0"
1212
"boto3" = "==1.6.6"
1313
botocore = "==1.9.6"
@@ -19,15 +19,15 @@ dataclasses = "==0.4"
1919
docutils = "==0.14"
2020
elasticsearch = "==6.2.0"
2121
elasticsearch-dsl = "==6.1.0"
22-
Flask = "==0.12.2"
23-
"Flask-S3" = "==0.3.3"
22+
flask = "==0.12.2"
23+
"flask-s3" = "==0.3.3"
2424
idna = "==2.6"
2525
ipaddress = "==1.0.19"
2626
itsdangerous = "==0.24"
27-
"Jinja2" = "==2.10"
27+
"jinja2" = "==2.10"
2828
jmespath = "==0.9.3"
2929
jsonschema = "==2.6.0"
30-
MarkupSafe = "==1.0"
30+
markupsafe = "==1.0"
3131
mccabe = "==0.6.1"
3232
mock = "==2.0.0"
3333
mypy = "==0.560"
@@ -44,11 +44,11 @@ requests = "==2.18.4"
4444
"s3transfer" = "==0.1.13"
4545
snowballstemmer = "==1.2.1"
4646
thrift = "==0.11.0"
47-
thrift_connector = "==0.23"
47+
thrift-connector = "==0.23"
4848
typed-ast = "==1.1.0"
4949
"urllib3" = "==1.22"
50-
Werkzeug = "==0.13"
51-
WTForms = "==2.1"
50+
werkzeug = "==0.13"
51+
wtforms = "==2.1"
5252
bleach = "*"
5353

5454

Pipfile.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

requirements/dev.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
amazon-kclpy==1.4.4
2-
arxiv-base==0.5.1
2+
arxiv-base==0.6.1
33
boto==2.48.0
44
boto3==1.6.6
55
botocore==1.9.6

requirements/prod.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
amazon-kclpy==1.4.4
2-
arxiv-base==0.5.1
2+
arxiv-base==0.6.1
33
boto==2.48.0
44
boto3==1.6.6
55
botocore==1.9.6

search/controllers/advanced/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,6 @@ class AdvancedSearchForm(Form):
170170
('-submitted_date', 'Submission date (newest first)'),
171171
('submitted_date', 'Submission date (oldest first)'),
172172
('', 'Relevance')
173-
], validators=[validators.Optional()], default='-announced_date_first')
173+
], validators=[validators.Optional()], default='')
174174
include_older_versions = BooleanField('Include older versions '
175175
'of papers in results')

search/controllers/simple/__init__.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,18 @@ def search(request_params: dict) -> Response:
8484
# Fall back to form-based search.
8585
form = SimpleSearchForm(request_params)
8686

87-
# Temporary workaround to support classic help search
88-
if form.query.data and form.searchtype.data == 'help':
89-
return {}, status.HTTP_301_MOVED_PERMANENTLY,\
90-
{'Location': 'https://arxiv.org/help/search?method=and'
91-
f'&format=builtin-short&sort=score&words={form.query.data}'}
87+
if form.query.data:
88+
# Temporary workaround to support classic help search
89+
if form.searchtype.data == 'help':
90+
return {}, status.HTTP_301_MOVED_PERMANENTLY,\
91+
{'Location': 'https://arxiv.org/help/search?method=and'
92+
f'&format=builtin-short&sort=score&words={form.query.data}'}
93+
94+
# Support classic "expeirmental" search
95+
elif form.searchtype.data == 'full_text':
96+
return {}, status.HTTP_301_MOVED_PERMANENTLY,\
97+
{'Location': 'http://search.arxiv.org:8081/'
98+
f'?in=&query={form.query.data}'}
9299

93100
q: Optional[Query]
94101
if form.validate():
@@ -120,6 +127,9 @@ def search(request_params: dict) -> Response:
120127
"search again. If this problem persists, please report it to "
121128
"help@arxiv.org."
122129
) from e
130+
except Exception as e:
131+
print(e)
132+
raise
123133
else:
124134
logger.debug('form is invalid: %s', str(form.errors))
125135
if 'order' in form.errors or 'size' in form.errors:

search/controllers/simple/forms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class SimpleSearchForm(Form):
4242
('-submitted_date', 'Submission date (newest first)'),
4343
('submitted_date', 'Submission date (oldest first)'),
4444
('', 'Relevance')
45-
], validators=[validators.Optional()], default='-announced_date_first')
45+
], validators=[validators.Optional()], default='')
4646

4747
def validate_query(form: Form, field: StringField) -> None:
4848
"""Validate the length of the querystring, if searchtype is set."""

search/process/tests.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,11 @@ def test_id(self):
1818
self.assertEqual(doc.id, '1234.56789')
1919

2020
def test_abstract(self):
21-
"""Field ``abstract`` is populated from ``abstract``."""
22-
meta = DocMeta(**{'paper_id': '1234.56789', 'abstract': 'abstract!'})
21+
"""Field ``abstract`` is populated from ``abstract_utf8``."""
22+
meta = DocMeta(**{
23+
'paper_id': '1234.56789',
24+
'abstract_utf8': 'abstract!'
25+
})
2326
doc = transform.to_search_document(meta)
2427
self.assertEqual(doc.abstract, 'abstract!')
2528

search/process/transform.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ def _constructACMClass(meta: DocMeta) -> Optional[list]:
4343

4444

4545
def _transformAuthor(author: dict) -> dict:
46+
# TODO: we should not be stripping punctuation from the name here.
47+
# This should be handled by the analyzer. This is related to ARXIVNG-543.
4648
author['first_name'] = _strip_punctuation(author['first_name']).strip()
4749
author['full_name'] = re.sub(r'\s+', ' ', f"{author['first_name']} {author['last_name']}")
4850
author['initials'] = [pt[0] for pt in author['first_name'].split() if pt]
@@ -81,7 +83,7 @@ def _constructDOI(meta: DocMeta) -> List[str]:
8183
TransformType = Union[str, Callable]
8284
_transformations: List[Tuple[str, TransformType, bool]] = [
8385
("id", lambda meta: meta.paper_id if meta.is_current else _constructPaperVersion(meta), True),
84-
("abstract", "abstract", False),
86+
("abstract", "abstract_utf8", False),
8587
("authors", _constructAuthors, True),
8688
("authors_freeform", "authors_utf8", False),
8789
("owners", _constructAuthorOwners, False),

search/services/index/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,6 @@ def handle_es_exceptions() -> Generator:
9292
class SearchSession(object):
9393
"""Encapsulates session with Elasticsearch host."""
9494

95-
# TODO: we need to take on security considerations here. Presumably we will
96-
# use SSL. Presumably we will use HTTP Auth, or something else.
97-
9895
def __init__(self, host: str, index: str, port: int=9200,
9996
scheme: str='http', user: Optional[str]=None,
10097
password: Optional[str]=None, mapping: Optional[str]=None,

0 commit comments

Comments
 (0)