using or operator in twitter keywords search

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

using or operator in twitter keywords search

Preben.Asmussen
Just used the twitter component for a small demo, and stumbled on a missing feature.

It would be nice if you where able to use or operator in the twitter keywords option. Maybe even be able to combine and/or in keywords.
Should be possible in twitter4j, but i'm not sure.

Best,
Preben
Reply | Threaded
Open this post in threaded view
|

Re: using or operator in twitter keywords search

Claus Ibsen-2
Hi

Yeah I assume configuring from endpoint uri, we would need some syntax
to define if its OR AND etc.
eg we could have AND OR as prefix to tell if the keyword is AND or OR based.

keywords=AND Apache,AND Camel,OR Donkey

Or have multiple options (where keywords is AND based)
keywords=Camel,Apache
keywordsOr=Donkey

The current keywords is comma based, we could also have a syntax with
AND OR as tokens.

keywords=Apache AND Camel OR Donkey



On Wed, May 1, 2013 at 9:17 PM, Preben.Asmussen <[hidden email]> wrote:

> Just used the twitter component for a small demo, and stumbled on a missing
> feature.
>
> It would be nice if you where able to use or operator in the twitter
> keywords option. Maybe even be able to combine and/or in keywords.
> Should be possible in twitter4j, but i'm not sure.
>
> Best,
> Preben
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/using-or-operator-in-twitter-keywords-search-tp5731873.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Reply | Threaded
Open this post in threaded view
|

Re: using or operator in twitter keywords search

Preben.Asmussen
Reply | Threaded
Open this post in threaded view
|

Re: using or operator in twitter keywords search

Bruno Borges
Twitter has its own operators. Just use them in your "keywords" parameter:

https://support.twitter.com/articles/71577-using-advanced-search

The documentation might be misleading you to believe that you can only use
comma-separated keywords. Actually, the keyword parameter value is passed
directly to the Query object of Twitter4J:

    public List<Tweet> pollConsume() throws TwitterException {
        String keywords = te.getProperties().getKeywords();
        Query query = new Query(keywords);
        if (te.getProperties().isFilterOld()) {
            query.setSinceId(lastId);
        }
        LOG.debug("Searching twitter with keywords: {}", keywords);
        return search(query);
    }

Let me know if it helps.


*Bruno Borges*
(11) 99564-9058
*www.brunoborges.com*


On Thu, May 2, 2013 at 3:59 AM, Preben.Asmussen <[hidden email]> wrote:

> Created https://issues.apache.org/jira/browse/CAMEL-6332 so we don't
> forget.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/using-or-operator-in-twitter-keywords-search-tp5731873p5731887.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: using or operator in twitter keywords search

Claus Ibsen-2
Hi

Thanks for sharing that link to this search page.
I have added a note to the Camel twitter docs.

On Thu, May 9, 2013 at 10:42 PM, Bruno Borges <[hidden email]> wrote:

> Twitter has its own operators. Just use them in your "keywords" parameter:
>
> https://support.twitter.com/articles/71577-using-advanced-search
>
> The documentation might be misleading you to believe that you can only use
> comma-separated keywords. Actually, the keyword parameter value is passed
> directly to the Query object of Twitter4J:
>
>     public List<Tweet> pollConsume() throws TwitterException {
>         String keywords = te.getProperties().getKeywords();
>         Query query = new Query(keywords);
>         if (te.getProperties().isFilterOld()) {
>             query.setSinceId(lastId);
>         }
>         LOG.debug("Searching twitter with keywords: {}", keywords);
>         return search(query);
>     }
>
> Let me know if it helps.
>
>
> *Bruno Borges*
> (11) 99564-9058
> *www.brunoborges.com*
>
>
> On Thu, May 2, 2013 at 3:59 AM, Preben.Asmussen <[hidden email]> wrote:
>
>> Created https://issues.apache.org/jira/browse/CAMEL-6332 so we don't
>> forget.
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/using-or-operator-in-twitter-keywords-search-tp5731873p5731887.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>



--
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: [hidden email]
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen