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

Fixed an issue where search_pubs returns an empty response when only a single publication exists for the query. #542

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

keko24
Copy link

@keko24 keko24 commented Jun 24, 2024

Fixes #541 #517.

Description

  • Fixed an issue where you get an empty response when you try to use search_pubs and only a single publication exists for the query. This is because the paper html element has a different class list when only a single publication exists.
  • Changed the _SearchScholarIterator object to set the total_results equal to the length of _rows. This is because a page in scholar containing a single result doesn't contain a div that says "About n results", from which _get_total_results derives the number of publications.
  • Added a unit test for this issue.

Checklist

  • Check that the base branch is set to develop and not main.
  • Ensure that the documentation will be consistent with the code upon merging.
  • Add a line or a few lines that check the new features added.
  • Ensure that unit tests pass.
    If you don't have a premium proxy, some of the tests will be skipped.
    The tests that are run should pass without raising
    MaxTriesExceededException or other exceptions.

Copy link
Collaborator

@arunkannawadi arunkannawadi left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, just one quick change and a generic comment.

test_module.py Outdated Show resolved Hide resolved
scholarly/publication_parser.py Show resolved Hide resolved
@keko24 keko24 requested a review from arunkannawadi July 1, 2024 21:36
@keko24
Copy link
Author

keko24 commented Jul 3, 2024

Hey @arunkannawadi, would you like to review the changes?

Copy link
Collaborator

@arunkannawadi arunkannawadi left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the changes. My only other comment is whether gs_r gs_or gs_scl gs_fmar overrides the other without gs_fmar. I didn't see the former in the test case you modified, so I think it should be harmless and does not result in double counting.

@arunkannawadi arunkannawadi changed the base branch from main to develop July 3, 2024 14:43
@arunkannawadi arunkannawadi merged commit 568d4ad into scholarly-python-package:develop Jul 3, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

using 'search_pubs()' as stated in the docs raises a StopIteration Error
2 participants