Changeset 1376


Ignore:
Timestamp:
02/15/07 17:32:33 (13 years ago)
Author:
szabolcs
Message:

ref #1152 spent 20m

Not closing yet as lemill should report 'No results' instead of just showing an empty box

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LargeSectionFolder.py

    r1361 r1376  
    665665        if hits.has_key(''): 
    666666            del hits[''] 
    667         resultlist=[(x[1], x[0]) for x in hits.items() if x[1]>0]  
     667        resultlist=[(x[1], x[0]) for x in hits.items() if x[1]>0] 
     668        if not resultlist: 
     669            return [] 
    668670        resultlist.sort() 
    669671        resultlist.reverse() 
     
    671673        # if the first cut score for tag is x, we want to cut off all of the tags with score x.  
    672674        if len(resultlist)>100: 
    673             resultlist= resultlist[:100] 
    674             smallest=resultlist[100][0] 
    675             cutpoint=99 
    676             small_value=resultlist[cutpoint][0] 
    677             # keep going down the list as long as the scores are equal 
    678             while small_value==smallest: 
    679                 cutpoint=cutpoint-1 
    680                 small_value=resultlist[cutpoint][0] 
    681             resultlist=resultlist[:cutpoint+1] 
     675            resultlist = resultlist[:[x[0] for x in result].index(resultlist[100])] 
    682676        resultlist=[(x[1], x[0], '',x[1],x[1]) for x in resultlist] 
    683677 
    684678        # adjust to 1-8. We don't have to worry about score 0, they're already removed. 
    685679        if maxcount>1: 
    686             resultlist=map(adjust, resultlist)          
     680            resultlist=map(adjust, resultlist) 
    687681        # prettify language names 
    688682        if index_type=='Language' or index_type=='getLanguage_skills': 
Note: See TracChangeset for help on using the changeset viewer.