Ejemplo n.º 1
0
def getXapianweiboByTs(start_time, end_time):
    xapian_date_list =[]
    days = (int(end_time) - int(start_time)) / Day

    for i in range(0, days):
        _ts = start_time + i * Day
        xapian_date_list.append(ts2datetimestr(_ts))

    statuses_search = getXapianWeiboByDuration(xapian_date_list)
    return statuses_search
Ejemplo n.º 2
0
    ts = te = time.time()
    for weibo in weibos:
        terms = weibo['terms']
        user = weibo['user']
        areas_list = []

        for term in terms:
            try:
                areas_list.extend(protowords[term])
            except KeyError:
                pass

        for area in areas_list:
            r.zadd(GLOBAL_USER_AREA_COUNT % area, 1, user)

        if iter_count % 10000 == 0:
            te = time.time()
            print iter_count, '%s sec' % (te - ts)
            ts = te

        iter_count += 1


if __name__ == '__main__':
    r = _default_redis()
    update_datestr = '20131228'
    datestr_list = ['20130901', '20130902', '20130903', '20130904', '20130905']
    xapian_search_weibo = getXapianWeiboByDuration(datestr_list)
    #calFieldByFriends()

    calFieldByWords()