Skip to content
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

Add aff query #103

Merged
merged 1 commit into from
Feb 28, 2019
Merged

Add aff query #103

merged 1 commit into from
Feb 28, 2019

Conversation

monaawi
Copy link
Contributor

@monaawi monaawi commented Dec 7, 2018

Added special query for affiliations

@@ -708,6 +709,10 @@ def visit_value(self, node, fieldnames=None):
elif ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['type-code'] == fieldnames:
return self._generate_type_code_query(node.value)

elif ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['affiliation'] == fieldnames:
query = generate_match_query(ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['affiliation'], node.value, with_operator_and=True)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
query = generate_match_query(ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['affiliation'], node.value, with_operator_and=True)
query = generate_match_query(
ElasticSearchVisitor.KEYWORD_TO_ES_FIELDNAME['affiliation'],
node.value,
with_operator_and=True
)



def test_affiliation_query():
query_str = 'aff:CERN'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about the other cases?

'affiliation': 'affiliation',
'affil': 'affiliation',
'aff': 'affiliation',
'af': 'affiliation',

Copy link
Contributor Author

@monaawi monaawi Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The query parser transforms all the shortcuts to 'affiliation' a step before visiting value so all the cases are covered but I will add them in the test

Added special query for affiliations
@monaawi monaawi merged commit 04a3dd4 into inspirehep:master Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants