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

Fix title retrieval in page function. #287

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PhoenixCreation
Copy link

Problem

Cause of Problem

  • When calling the summary function, it calls the page function. where is auto_suggest is true then we try to check for the valid title through search function which return the results and suggestion.
  • But while assigning the title variable title = suggestion or results[0] like this we are applying the suggestion first and if suggestion not found then result. Which causes this problem.
  • Actually title = results[0] or suggestion should be used which means set title to results[0] first and if results[0] is not available then set it to suggestion.

Changes

  • At file wikipedia/wikipedia.py line 272
- suggestion or results[0]
+ results[0] or suggestion

Fixes

Correct the order of title assignment in page function. line 272.
title should be assigned with result[0] first instead of suggestion first.
```diff
- suggestion or results[0]
+ results[0] or suggestion
```
@wlerin
Copy link

wlerin commented Jun 29, 2022

If results[0] is not available this will throw an IndexError, not set title to suggestion.

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.

None yet

2 participants