goldsmith / Wikipedia

A Pythonic wrapper for the Wikipedia API
https://wikipedia.readthedocs.org/
MIT License
2.89k stars 519 forks source link

Throwing exception Showing different results from actual search #258

Open ayushmi77al opened 3 years ago

ayushmi77al commented 3 years ago

wikipedia.exceptions.WikipediaException: An unknown error occured: "The "srsearch" parameter must be set.". Please report it on GitHub! It is also showing different results like showing about gold instead of god and hell instead of hello like this.

35ch commented 3 years ago

I can confirm this issue as well. Some results show the wrong ids, for example discord: PageError: Page id "discor" does not match any pages. Try another id!

thepartisan101 commented 3 years ago

Having the same issue, seems that some names or strings get parsed the wrong way. Examples:

  1. With name "Elon Musk", using wikipedia.search("Elon Musk"), I get: ['Elon Musk', 'Views of Elon Musk', "Elon Musk's Tesla Roadster", 'The Boring Company', 'Kimbal Musk', 'Maye Musk', 'Talulah Riley', 'Tosca Musk', 'Justine Musk', 'Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future'] which is correct, but if I try wikipedia.page("Elon Musk") I get: PageError: Page id "e on musk" does not match any pages. Try another id!

If I try wikipedia.page('Tim Ferriss') which gives good results using .search(), it makes the same error: PageError: Page id "tim ferris’s" does not match any pages. Try another id!

I think the author is using some regex rules to parse what could look like an apostrophe (like something's in Ferriss) and for "Elon" as "e on" is parsin the "l" as a separator?

wlerin commented 3 years ago

Auto suggestion is on by default for page and summary. Turn it off by passing auto_suggest=False.

@goldsmith Results from Wikipedia's autosuggestion are unbelievably bad, and shouldn't be the default for anything. Maybe they were decentish 8 years ago when that code was written.