Insights for Twitter service in IBM Bluemix: Search case-sensitive string and other questions

210 views Asked by At

I am trying to search for a case-sensitive string in Twitter. I know the standard query is case-insensitive. How can I do case-sensitive search?

Also, the search arguments are "AND". Is there a way that I can write arguments and treat them as "OR"? To say it more clear, for illustration, I would like to search for tweets with either one of the following arguments: bio_location:"Philippines" or country_code:PH. I don't want to use "AND" because I am aware that there are users without bio_location and also some users only have country_code populated. So I want to get those who will satisfy any one of these arguments.

Another question, is there a way that I can filter out retweets?

Thank you!

2

There are 2 answers

0
Ben Rondeau On

In answer to your questions....

1) You can use an 'exact phrase match' for case-sensitivity - see API docs for more on this. Not sure what your use case is, so this may or may not work for you.

2) Currently the 'OR' conditional is not supported by the API, or at least it is not documented in the API. I will get in touch with our developers to see if it is possible but not documented. In the mean time, you can do an two API calls and process the data server side (such as removing duplicates).

3) Filtering out retweets is possible. See API docs here under get /v1/messages/search. Look specifically under the message.bodywhere it states: For Retweets, Twitter modifies the value of the body at the root level. Your application should look at the object.body to ensure that it is extracting the non-modified text.

Hope this helps!

0
rkung On

2) "OR" is supported. See Query language for usage of the OR operator. Searching for "bio_location:"Philippines" OR country_code:PH" should work.