Skip to content

Commit

Permalink
Merge pull request #237 from kelockhart/orcid-fix
Browse files Browse the repository at this point in the history
Fix so length of orcid_pub matches length of author
  • Loading branch information
spacemansteve authored Jan 28, 2020
2 parents e4c9956 + ea3d58b commit 240508d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aip/classic/solr_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def _keyword_facet(ADS_record):
def _orcid(ADS_record):
authors = ADS_record['metadata']['general'].get('authors', [])
authors = sorted(authors, key=lambda k: int(k['number']))
result = [i['orcid'] if i['orcid'] else u'-' for i in authors]
result = [i['orcid'] if i['orcid'] else u'-' for i in authors if i['type'] in AUTHOR_TYPES]
out = {'orcid_pub': result}
if 'orcid_claims' in ADS_record:
for indexname, claimname in [('orcid_user', 'verified'), ('orcid_other', 'unverified')]:
Expand Down
6 changes: 3 additions & 3 deletions tests/classic/test_solr_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def test_SolrAdapter(self):
'first_author': u"t'Hooft, van X",
'first_author_facet_hier': [u'0/T Hooft, V', u"1/T Hooft, V/t'Hooft, van X"],
'first_author_norm': u'T Hooft, V',
'orcid_pub': [u'-', u'-', u'-'],
'orcid_pub': [u'-', u'-'],
'orcid_user': [u'-', u'1111-2222-3333-4444', u'-'],
'page_count': 0,
'author_count': 2,
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_SolrAdapter(self):
'first_author': u"t'Hooft, van X",
'first_author_facet_hier': [u'0/T Hooft, V', u"1/T Hooft, V/t'Hooft, van X"],
'first_author_norm': u'T Hooft, V',
'orcid_pub': [u'-', u'-', u'-'],
'orcid_pub': [u'-', u'-'],
'orcid_user': [u'-', u'1111-2222-3333-4444', u'-'],
'page_count': 0,
'author_count': 2,
Expand Down Expand Up @@ -553,7 +553,7 @@ def test_SolrAdapter(self):
'first_author': u"Miller, Richard H.",
'first_author_facet_hier': [u'0/Miller, R', u'1/Miller, R/Miller, Richard H'],
'first_author_norm': u'Miller, R',
'orcid_pub': [u'-', u'-'],
'orcid_pub': [u'-'],
'orcid_user': [u'-', u'-'],
'page_count': 0,
'author_count': 1,
Expand Down

0 comments on commit 240508d

Please sign in to comment.