Hello,

I'm working on the design for a realtime like social search for a personal 
project I have at www.unscatter.com. I'm building on various apis like Bing, 
Blekko, Facebook, Twitter and more. 

One of the next items I want to implement is the ability to do a search and 
get constant updates from Facebook and Twitter. My instinct is to use the 
search api, rather than streams, because the queries won't be long lasting 
ones. The 2 implementation choices I see are

Both:
User submits a query for say "bird"
I'll check first to makes sure there isn't already a query running for 
"bird", if there is I'll poll the backend for it.
If there isn't a query running already, I'll initiate one by dropping "bird" 
in the datastore as an active query.
Then I'll have a secondary program which will do one of the following for 
Twitter specifically

Search api:
Will poll the api for "bird" for updates newer than the latest result 
already cached.
If it gets a result it will drop it in the datastore so that the front end 
can pick it up and deliver it to the consumer.

Stream:
Shut down any active stream
Start a new stream with "bird" added to the track list
Parse results as they come in, searching for "bird" and adding them to the 
query queue if it exists.

The engine running the queries will work off of a last request timestamp 
supplied by front ends to determine if the query is still active.
So for the 2 solutions

Search api:
Stop polling

Stream:
Shut the stream down and remove "bird" from the track list.

It seems to me that as these are short term queries that the search api is 
the way to go. I actually had this working just like that at one point 
before I did a rewrite of the application


note: I use the term datastore, but I'm not using appengine. It's a python 
tornado/mongodb architecture server side. 

Just want to validate that using the search api is appropriate here. 

I intend to add features later that will consume the stream using site 
stream for accounts, but this doesn't seem to be the appropriate place to 
start using it with the fact I'd be stopping and starting the stream to 
manage track keywords often.

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk

Reply via email to