-
Notifications
You must be signed in to change notification settings - Fork 5
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
Set limit on list results #12
base: master
Are you sure you want to change the base?
Conversation
| sentences | no | 10 | Integer in range 1-10 | if set, return the first number of sentences(can be no greater than 10) specified in this parameter. | | ||
| titles | no | ~ | Integer | With this parameter you can limit the number of search result in case there are more then one | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe titles is not the right name for this parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to wikipedia.summary those are auto_suggest.
So, what about auto_suggest
or auto_suggest_limit
?
@@ -39,7 +40,7 @@ def __init__(self, **kwargs): | |||
# The options property contains a list of titles of Wikipedia pages that the query may refer to. | |||
self.may_refer = e.options | |||
# Removing duplicates in lists. | |||
self.may_refer = list(set(self.may_refer)) | |||
self.may_refer = list(set(self.may_refer))[:self.titles] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the behavior if not set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it defaults to None thanks to line 23 self.titles = kwargs.get('titles', None)
and serves back all the results
In this way searches with many results like "me" can be limited in order to avoid a long and boring long message.