def sendDocumentToSolr(comment):
dateTimeFormat = '%Y-%m-%dT%H:%M:%SZ'
created_time = datetime.fromtimestamp(long(comment['time'])).strftime(dateTimeFormat)
try:
print "send it to solr"
s.add(
in_reply_to_object_id=objectId,
user_id=comment['fromid'],
name=comment['username'],
like_count=comment['likes'],
id=comment['id'],
created_at=created_time,
text_length_i=len(comment['text']),
text=comment['text']);
except solr.core.SolrException as solrerror:
print "OUCH !! Something bad happened Larry!"
print solrerror
评论列表
文章目录