Ejemplo n.º 1
0
def buildSolrQuery(custIds, maxRange):
    query = 'customerid:(' + StringSet.join(custIds, ' ') + ')'
    query = query + ' AND (storageid:[0 TO ' + str(maxRange) + '])'
    if EXTRA is not None:
        query = query + ' AND (' + EXTRA + ')'
    query = query + ' AND isattachment:false'
    return query
Ejemplo n.º 2
0
def buildFastQuery(custIds, maxRange):
    query = 'customerid:or(' + StringSet.join(custIds, ',') + ')'
    if maxRange is not None:
        newMax = InstreamFASTIDReconciliation.convertLongToOverflownFASTInt(maxRange)
        if newMax > 0:
            query = query + ' and (storageid:range(0,' + str(newMax) + ',from="GE",to="LE"))'
        else:
            query = query + ' and (not storageid:range(' + str(newMax) + ',0,from="GT",to="LE"))'
    if EXTRA is not None:
        query = query + ' and ' + EXTRA
    query = query + ' and isattachment:0'
    return query
Ejemplo n.º 3
0
def deleteMessages(cfMsgs,cfFile):
    if cfMsgs is None or len(cfMsgs) == 0:
        return

    idx = 0
    print time.asctime(),'There are %d items to pass to cleanup-fast' % len(cfMsgs)
    chunk = cfMsgs[idx:idx+200]
    print len(chunk)
    fd = open(cfFile,'a')
    try:
        try:
            while len(chunk) > 0:
                str = StringSet.join(chunk,',')
                q = 'OR(%s)' % str
                cmd = 'emscmd 2>/dev/null cleanup-fast -r -c -f -s -a -d -q \'storageid:%s\'' % q
                print time.asctime(),cmd
                idx = idx + 200
                chunk = cfMsgs[idx:idx+200]
                fd.write(cmd + '\n')
        except:
            print 'Exception', sys.exc_info(), traceback.print_exc(file=sys.stderr)
    finally:
        fd.close()