I'm 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 returned that tweet ?
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 out the keyword that was used without doing a string comparison loop (like a foreach )?
I have not found any attribute of the object that has the keyword, just the tweet data.