write_message("......Processing records #%s-%s"%(recids,recide))
recs=run_sql("SELECT id_bibrec,value FROM bib%sx,bibrec_bib%sx WHERE tag='%s' AND id_bibxxx=id and id_bibrec >=%s and id_bibrec<=%s"%(tag[0:2],tag[0:2],tag,recids,recide))
valid=HitSet(Numeric.ones(cfg_max_recID+1))
forkeyintags:
newset=HitSet()
newset.addlist(run_sql("SELECT id_bibrec FROM bib%sx,bibrec_bib%sx WHERE id_bibxxx=id AND tag='%s' AND id_bibxxx=id and id_bibrec >=%s and id_bibrec<=%s"%(tag[0:2],tag[0:2],key,recids,recide)))
valid.intersect(newset)
iftags:
recs=filter(lambdax:valid.contains(x[0]),recs)
records=records+list(recs)
write_message("Number of records found with the necessary tags: %s"%len(records))
write_message("Getting records from collections enabled for rank method.")
res=run_sql("SELECT collection.name FROM collection,collection_rnkMETHOD,rnkMETHOD WHERE collection.id=id_collection and id_rnkMETHOD=rnkMETHOD.id and rnkMETHOD.name='%s'"%rank_method_code)
l_of_colls=[]
forcollinres:
l_of_colls.append(coll[0])
iflen(l_of_colls)>0:
recIDs=perform_request_search(c=l_of_colls)
else:
recIDs=[]
valid=HitSet()
valid.addlist(recIDs)
returnvalid
defadd_date(rank_method_code,date=""):
"""If date is not set, then retrieve it from the database.
Reindex all formats newer than the modification date"""
ifnotdate:
try:
date=(get_lastupdated(rank_method_code),'')
exceptException,e:
date="0000-00-00 00:00:00"
query="""SELECT b.id FROM bibrec AS b WHERE b.modification_date >=
'%s'"""%date[0]
ifdate[1]:
query+="and b.modification_date <= '%s'"%date[1]
query+="ORDER BY b.id ASC"""
res=run_sql(query)
list=create_range_list(res)
ifnotlist:
ifoptions["verbose"]:
write_message("No new records added since last time method was run")