Search timeline

What’s the proper way to search through timeline entries programmatically?

While I’m at it…Given a list returned from the above query, how to update a doctype field with the results upon doctype modification?