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

Support new sort_order parameter #597

Closed
igorbrigadir opened this issue Feb 10, 2022 · 7 comments
Closed

Support new sort_order parameter #597

igorbrigadir opened this issue Feb 10, 2022 · 7 comments
Labels

Comments

@igorbrigadir
Copy link
Contributor

There is a new search parameter available, sort_order https://twittercommunity.com/t/introducing-the-sort-order-parameter-for-search-endpoints-in-the-twitter-api-v2/166377

By default, when the sort_order parameter is not used, the Tweets are returned based on recency (i.e. the most recent Tweets first). However, if you want the most relevant Tweets first, you can set the sort_order parameter to relevancy.

@edsu
Copy link
Member

edsu commented Feb 10, 2022

It's hard to imagine anyone finding this useful, but I guess it's good to have for parity?

@igorbrigadir
Copy link
Contributor Author

I thought it may have been interesting to implement if it matched the web relevancy, so you could audit how search results are presented, but unfortunately this isn't the case.

Note: this ranking is not the same as what you see in the Twitter client app

Might still be useful for a study that compares what's surfaced by platforms and relevancy algos etc?

Agreed that it might be worth implementing for completeness, but not as a priority maybe.

@edsu
Copy link
Member

edsu commented Feb 10, 2022

Yeah, it definitely could be interesting for meta questions about how Twitter works. But of limited interest to people collecting tweets I'd wager.

That being said, I'm definitely not opposed to adding it. Maybe someone will come up with a creative use!

@stuartduncan416
Copy link

Just to add a voice, as I was the one asking about it on the Twitter API forum.

I had a use scenario where I thought it would be useful. I am working with some researchers that wanted to do a Twitter API query that would result in millions of results. We thought about capping the results at about 1 million for a one year time period, but the results would all be from December 31st (the end date) to October (when it would hit the million mark). 1 million tweets scattered throughout the year would have worked better for them, as they just wanted a sample of tweets throughout the entire period. I thought we could use the sort_order flag to accomplish this.

@igorbrigadir
Copy link
Contributor Author

This might be a good first issue for someone else to implement, as all changes needed can be made in command2.py to support the new switch for sort order (and docs to clarify that sort order is more like filtered results than the same results in a different order) the client2.py should already support extra parameters in kwargs. I could be wrong though, maybe it's a bigger change than that, but finding that out is also a useful exercise! Knowing how to add stuff with click command line switches is definitely useful to know: https://click.palletsprojects.com/en/8.0.x/#

@mirkolenz
Copy link
Contributor

I opened a "draft" PR that includes support for the new parameter. I am happy for any kind of feedback as I would love to see this new feature in twarc (I would like to try it out as part of my ongoing research).

@igorbrigadir
Copy link
Contributor Author

Fixed in #645 Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants