Example #1
0
def getHistoryInfo(userid,rqtime,topnum):
    rows=tablerequest.getUserTopNewsids(dbconfig.requestable, userid, topnum, rqtime)
    records=[]
    for newsid,requestime in rows:
        record=tablemerge2.getRecordsByNewsid(dbconfig.mergetable2, newsid)
        if not record:
            continue
        record=record[0]
        record=_getRequestInfosfromMerge2Record(record, requestime)
        records.append(record)
    return records
Example #2
0
def getSearchedRelated(newsid,ctime='0',topnum=10,mtype=None,click=0):
    nInfos=[] 
    rows=tablemerge2.getRecordsByNewsid(mergetable2,newsid)
    if rows==-1 or len(rows)<1:
        return nInfos
    title=rows[0][3]      
    print title  
    records=search.searchWithLimit(title,limit=topnum+1)
    if records!=None and len(records)>0:
        for item in records:
            if item['newsid']==newsid:
                continue
            #4newsid,3title,2url,5thumb,6brief,9source,8ctime,10author,11description,12mtype,13click/related
            nInfos.append(NewsInfo(item['newsid'],item['title'],item['url'],item['thumb'],item['summary'],
                                    item['source'],item['ctime'],item['author'],item['description'],item['mtype'],
                                    [],0))
    if len(nInfos)>topnum:
        return nInfos[0:topnum]
    return nInfos
Example #3
0
def getW2vRelated(newsid,ctime='0',topnum=10,mtype=None,click=0):
    nInfos=[] 
    rows=tablemerge2.getRecordsByNewsid(mergetable2,newsid)
    if rows==-1 or len(rows)<1:
        return nInfos
    title=rows[0][3]      
    print title  
    records=w2vclient.getRelatedRecords2(title)
    if records!=None and len(records)>0:
        for item in records:
        #0id,1webid/mtid,2url,3title,4newsid,5thumb,6summary,7keywords,8ctime,9source,
        #10author,11description,12mtype,13click/related        
        #4newsid,3title,2url,5thumb,6brief,9source,8ctime,10author,11description,12mtype,13click/related
            # pass the same news
            if item[4]==newsid:
                continue
            nInfos.append(NewsInfo(item[4],item[3],item[2],item[5],item[6],item[9],item[8],
                                item[10],item[11],item[12],[],0))
    if len(nInfos)>topnum:
        return nInfos[0:topnum]    
    return nInfos