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

Set limit on list results #12

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

Conversation

daniego
Copy link

@daniego daniego commented Nov 24, 2018

In this way searches with many results like "me" can be limited in order to avoid a long and boring long message.

| 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 |
Copy link
Member

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

Copy link
Author

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]
Copy link
Member

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?

Copy link
Author

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

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.

2 participants