-
Notifications
You must be signed in to change notification settings - Fork 255
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
Add sort_order parameter for search api #645
Add sort_order parameter for search api #645
Conversation
I forgot to mention: I did not yet update the docs and tests as I wanted to wait for feedback on the actual implementation. As soon as that is cleared, I will update them as well. |
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.
Thanks for taking the time to submit a PR. This looks good so far, I've just noted one little added mistake in the docstrings.
It would be great if you could add a test case for the sort parameter as well - maybe just by expanding https://github.com/DocNow/twarc/blob/main/test_twarc2.py#L102 with an additional case for the new parameter? Let me know if you want any help with that.
@igorbrigadir might have some more specific thoughts about how to handle the CLI parameters though.
Sorry, I missed your comment about adding the tests later - I'm happy to merge and release once there's a test unless there's any objections. |
I have updated/fixed the docstrings, updated the method you linked via a |
Awesome! thanks so much! The |
As discussed in #597, Twitter added the new field
sort_order
to their search endpoints. This PR is a first attempt to include this new parameter intwarc
. In my tests, settingsort_order="relevancy"
gave a different ordering of results, thus I think it should work.One comment on my code: Initially, I wanted to add this new parameter to the
command_line_search_options
decorator. However, it is also used for thecounts
endpoint, which does not provide the parametersort_order
. Thus, I included the click option for every relevant function individually.I am happy to modify my code according to your recommendations 😃