def getRelatedRecords(title): # default return 10 most related news if has enough mvids=_getRelatedMids(title) records=[] for mvid in mvids: rows=tablemerge.getRecordsByMVid(dbconfig.mergetable,mvid) if rows !=-1 and len(rows)>0: records.append(rows[0]) return records
def getRelatedNewsList(title,startday=30,enday=None,topnum=10): # According to title,find out the related news @param startday: from now, # @param topnum: top related number # relatedTitleList=getRelatedNewsTitleList(title,startday,enday,topnum) if relatedTitleList==None or len(relatedTitleList)<1: return relatedNewsList=[] for newsTitle in relatedTitleList: rows=tablemerge.getRecordsByMVid(dbconfig.mergetable,newsTitle.getMvid()) if rows !=-1 and len(rows)>0: relatedNewsList.append(rows[0]) return relatedNewsList