def searchCount(mc,custId): sm = mc.getIndexSearchManager() isc = IndexSearchConstraint(custId,None) qb = SolrQueryBuilder(custId) print 'generatedQuery=',qb.getQuery() sr = sm.search(qb.getQuery(),isc,None,IIndexSearchManager.CallerApp.REVIEWER_SEARCH) return sr.getDocCount()
def searchCountQL(mc,custid,query,language,attach_scope): sm = mc.getIndexSearchManager() isc = IndexSearchConstraint(custid,None) qb = SolrQueryBuilder(custid); qb.applyLanguage(language) qb.applyAttachmentScope(attach_scope) qb.applyComplexSearch(query,'',[],True,False) sr = sm.search(qb.getQuery(),isc,None,CallerApp.TESTING) return sr.getDocCount()
if __name__ == '__main__': if len(sys.argv) != 7: print 'Usage:',sys.argv[0],'cust-id keywords sender receivers subject attachment' print len(sys.argv) sys.exit(1) print 'custid="'+sys.argv[1]+'"' print 'keywords="'+sys.argv[2]+'"' print 'sender="'+sys.argv[3]+'"' print 'receivers="'+sys.argv[4]+'"' print 'subject="'+sys.argv[5]+'"' print 'attachment="'+sys.argv[6]+'"' mc = ManagementContainer.getInstance() sm = mc.getIndexSearchManager() isc = IndexSearchConstraint(int(sys.argv[1]),None) qb = SolrQueryBuilder(int(sys.argv[1])); qb.applyLanguage('en') qb.applyComplexSearch(sys.argv[2],'',[],False,False) qb.applyFileName(sys.argv[6],None) qb.applyRecipients(sys.argv[4],False) qb.applyFrom(sys.argv[3]) qb.applySubject(sys.argv[5]) sr = sm.search(qb.getQuery(),isc,None,CallerApp.TESTING) print sr.getDocCount() sys.exit(0)