Example #1
0
def getSearchedRelated(web,mvid,loadtime='0',topnum=10,mtype=None,click=0):
    vnInfos=[] 
    rows=tablemerge.getTitleByMVid(ctable,mvid)
    if rows==-1 or len(rows)<1:
        return vnInfos
    title=rows[0][0]      
#     print title  
    records=search.searchWithLimit(title,limit=topnum+1)
    if records!=None and len(records)>0:
        for item in records:
            if item['mvid']==mvid:
                continue
            #2vid,3title,4url,5thumb,6brief,10source,12loadtime,13duration,14web,15mvid,16mtype,17click
            vnInfos.append(NewsInfo(item['vid'],item['title'],item['url'],item['thumb'],item['summary'],item['source'],
                                    item['loadtime'],item['duration'],item['web'],item['mvid'],item['mtype'],item['click']))
    if len(vnInfos)>topnum:
        return vnInfos[0:topnum]
    return vnInfos
Example #2
0
def getW2vRelated(web,mvid,loadtime='0',topnum=10,mtype=None,click=0):
    vnInfos=[] 
    rows=tablemerge.getTitleByMVid(ctable,mvid)
    if rows==-1 or len(rows)<1:
        return vnInfos
    title=rows[0][0]  
    records=w2vclient.getRelatedRecords2(title)
    if records!=None and len(records)>0:
        for item in records:
        #0id,1webid,2vid,3title,4url,5thumb,6summary,7keywords,8newsid,9vtype,10source,
        #11related,12loadtime,13duration,14web,15mvid,16mtype,17click
        #2vid,3title,4url,5thumb,6brief,10source,12loadtime,13duration,14web,15mvid,16mtype,17click
            # pass the same news
            if item[15]==mvid:
                continue
            vnInfos.append(NewsInfo(item[2],item[3],item[4],item[5],item[6],item[10],
                                    item[12],item[13],item[14],item[15],item[16],item[17]))
    if len(vnInfos)>topnum:
        return vnInfos[0:topnum]    
    return vnInfos