Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Streaming: Hashtags in OR rather than in AND #221

Open
DanielaSfregola opened this issue May 29, 2018 · 3 comments
Open

Streaming: Hashtags in OR rather than in AND #221

DanielaSfregola opened this issue May 29, 2018 · 3 comments

Comments

@DanielaSfregola
Copy link
Owner

DanielaSfregola commented May 29, 2018

This came from a discussion on Gitter:

"""
I am going to create a ticket to investigate if we can compose hashtags when streaming, i.e.: create a stream that returns tweet about #scala OR #functionalprogramming.
I know you can do it with the search REST api (since they have a dedicated syntax)
....not sure about the streaming API
"""

@DanielaSfregola
Copy link
Owner Author

DanielaSfregola commented May 30, 2018

You can indeed! By concatenating tracks using spaces instead of commas.

EDIT: ORs are expressed with commas, AND are expressed with spaces

See https://developer.twitter.com/en/docs/tweets/filter-realtime/guides/basic-stream-parameters#track

@wzorgdrager
Copy link

I think it is the other way around if I read the docs.
By this model, you can think of commas as logical ORs, while spaces are equivalent to logical ANDs (e.g. ‘the twitter’ is the AND twitter, and ‘the,twitter’ is the OR twitter).
So that means you would support OR by default, while AND is also implicitly supported (just add one string with spaces)

@DanielaSfregola
Copy link
Owner Author

DanielaSfregola commented May 30, 2018

Thanks @wzorgdrager! You are absolutely right -- I've fixed my comment.

SHORT TERM SOLUTION: Currently we use Seq[String] that is then converted to comma-separated list. So maybe all we need is just better scaladoc to clarify this difference

LONG TERM SOLUTION: When we have time, we should also think of having a dedicated type to express this ANDs - ORs relations (we could use it for the search API too!): Seq[String] is not expressive enough!

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

No branches or pull requests

2 participants