1
I am developing a system that uses Apache Storm integrated with the Twitter4j library, to process tweets in real time. But I have a problem: Is there any way to know which keyword that originated that tweet returned?
Example:
//Palavras-chave para a criação da topologia do Storm
String keywords[] = {"Palavra 1", "Palavra 2"};
//Este método é chamado quando é retornado um tweet que contém aquela palavra-chave
@Override
public void execute(Tuple tuple, BasicOutputCollector collector) {
Status status = (Status) tuple.getValueByField("tweet");
System.out.println(status);
}
//Resultado do Sysout
StatusJSONImpl{createdAt=Wed Sep 16 13:55:52 BRT 2015, id=645265788760587264, text='RT @user: Este é um tweet da Palavra 1' ... }
StatusJSONImpl{createdAt=Wed Sep 16 13:55:56 BRT 2015, id=645265788760587265, text='RT @user: Este é um tweet da Palavra 2' ... }
Is there any way to find the keyword that was used without making a string comparison loop (such as a foreach)?
I did not find any object attribute that has the keyword, only the data from tweet.