Twitter Search Api: Determine matched phrase / keyword

search

#1

Is there a way to determine which part of the query matched the tweet in the results of the search api?

If not, any idea how twitter determines a match such that we can recreate this to determine what triggered the keyword match?


#2

It seems twitter also matches on url’s and url snippets which don’t seem present in the search results document.

Any twitter devs or gurus know of a secret param that gets twitter to tell us what matched?

Thanks!


#3

There’s no way to get that (why a term matched) data from the API. Are you using the Streaming API, or the Search API in REST?


#4

Hi Andy,

Is there a way to do this via the Streaming API? currently we use both in different capacities.


#5

The REST API and stream use different ways to return the information. My limited understanding is they both include a type of context, not necessarily the actual keyword your looking for. For example, a quoted tweet could be included in the search results where the actual tweet does not include the search result, but the tweet being quoted does. Also, the thread itself could be talking about the item you’re looking for, and you’ll get tweets from the thread that don’t actually include the keyword.

The Stream gets better results, but as it’s a live feed, there are several things you need to take into account. REST will get you historical, but only a sampling from a limited period of time.

One option to filter tweets that don’t include the keywords would be to look at the tweet being quoted for the keyword. My guess is most often people just delete the tweet if it doesn’t explicitly include the keyword you’re looking for - developers prerogative, really.

A good option would be to use the Stream to collect tweets, and when a tweet does not contain the keyword use REST to try to figure out the cause.

It all depends what you want, and how far you’re willing to go to get it.