def searchCountQL(mc,custid,query,language,attach_scope): sm = mc.getIndexSearchManager() isc = IndexSearchConstraint(custid,None) qb = FastQueryBuilder(custid); qb.applyLanguage(language) qb.applyAttachmentScope(attach_scope) qb.applyDefaultSearch(query,True,False) sr = sm.search(qb.getQuery(),isc,None,CallerApp.TESTING) return sr.getDocCount()
def searchCount(mc,custid,keywords,sender,receiver,subject,attachment,language,attach_scope,rg = None): sm = mc.getIndexSearchManager() isc = IndexSearchConstraint(custid,None) if None != rg : isc.constrainByReviewerGroup(rg) qb = FastQueryBuilder(custid); qb.applyLanguage(language) qb.applyAttachmentScope(attach_scope) qb.applyDefaultSearch(keywords,False,False) qb.applyFileName(attachment,None) qb.applyRecipients(receiver,False) qb.applyFrom(sender) qb.applySubject(subject) sr = sm.search(qb.getQuery(),isc,None,CallerApp.TESTING) return sr.getDocCount()