Changeset 5844 for MILK


Ignore:
Timestamp:
15/10/09 10:00:36 (10 years ago)
Author:
sdonegan
Message:

Updates to allow proper paging as per num of search results and ordering of orderby without letter prefix

Location:
MILK/trunk/milk_server/milk_server/controllers/browse
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MILK/trunk/milk_server/milk_server/controllers/browse/browserconstants.py

    r5785 r5844  
    2323                         }''' 
    2424 
    25 ORDERBY_SENSIBLE_NAMES = {'A.    Text matches':'textRelevance', 
    26                           'B.    Dataset name':'datasetOrder', 
    27                           'C.    Data centre name':'dataCentre', 
    28                           'D.    Dataset start date':'datasetStartDate', 
    29                           'E.    Dataset end date':'datasetEndDate',                           
    30                           'F.    Popularity of dataset by links followed':'datasetLinkedPopularity', 
    31                           'G.    Number of times dataset included in other results':'datasetResultsetPopularity', 
    32                           'H.    Proximity to centre of spatial search':'proximity', 
    33                           'I.    Results not in but within 10% of original AOI':'proximityNearMiss', 
    34                           'J.    Date of most recent change to metadata':'datasetUpdateOrder', 
    35                           'K.    Date of ingest into DDS catalogue':'discoveryIngestDate' 
     25ORDERBY_SENSIBLE_NAMES = {'Text matches':'textRelevance', 
     26                          'Dataset name':'datasetOrder', 
     27                          'Data centre name':'dataCentre', 
     28                          'Dataset start date':'datasetStartDate', 
     29                          'Dataset end date':'datasetEndDate',                           
     30                          'Popularity of dataset by links followed':'datasetLinkedPopularity', 
     31                          'Number of times dataset included in other results':'datasetResultsetPopularity', 
     32                          'Proximity to centre of spatial search':'proximity', 
     33                          'Results not in but within 10% of original AOI':'proximityNearMiss', 
     34                          'Date of most recent change to metadata':'datasetUpdateOrder', 
     35                          'Date of ingest into DDS catalogue':'discoveryIngestDate' 
    3636                          } 
    3737 
     38#Use this list to provide the order of ordering indexes in list - can omit any too 
     39ORDERING_KEY=['Text matches','Dataset name','Data centre name','Dataset start date','Dataset end date','Popularity of dataset by links followed','Popularity of dataset by links followed', 
     40              'Number of times dataset included in other results','Proximity to centre of spatial search','Date of most recent change to metadata','Date of ingest into DDS catalogue'] 
     41               
    3842 
    3943# various error messages 
  • MILK/trunk/milk_server/milk_server/controllers/browse/discovery.py

    r5785 r5844  
    6464        #nb. webhelpers suck so no wuse own construct of option vals based on bc.ORDERBY_SENSIBLE_NAMES 
    6565        orderSensibleNames = bc.ORDERBY_SENSIBLE_NAMES 
    66          
    67         orderSensibleNamesSorted = {} 
    68                 
    69         sortedKeys = orderSensibleNames.keys() 
    70         sortedKeys.sort() 
    71         optionList=[] # do it myself. who needs webHelpers anyway. 
    72  
    73              
    74         for orderSel in sortedKeys: 
     66        orderOrderingList = bc.ORDERING_KEY #now use this ordering key to provide ordering in list. 
     67               
     68        optionList=[] # do it myself. who needs webHelpers anyway.#TODI: abstract a webhelpers class so can provide an orderlist as index etc (like we've done here). 
     69 
     70             
     71        for orderSel in orderOrderingList: 
    7572             
    7673            if orderSensibleNames[orderSel] in g.orderByList: 
     
    8178                else:            
    8279                    optionList.append("<option value=\"" + orderSensibleNames[orderSel] + "\">" + orderSel + "</option>") 
    83                  
    84                  
    85                 #python is useless when it comes to handling dictionaries - arbritrary sorting!  this sucks.  use java.  grrr. 
    86                 orderSensibleNamesSorted[orderSel] = orderSensibleNames[orderSel] 
    87                  
     80                                
    8881            else: 
    8982                 
    9083                optionList.append("<option value=\"" + orderSel + "\">" + orderSel + "</option>")               
    91                 orderSensibleNamesSorted[orderSel] = orderSel 
    92          
    93          
    94         
    95         #c.orderByList = h.options_for_select(g.orderByList, self.inputs['orderBy']) 
    96         #c.orderByList = h.options_for_select(kkk, self.inputs['orderBy'])         
     84                 
     85         
     86        #TODO - see above 
     87        #c.orderByList = h.options_for_select(g.orderByList, self.inputs['orderBy'])         
    9788        c.orderByList = optionList # see above comment on how much python sucks when it comes to dictionaries!  If you don't believe me uncomment above lines. 
    9889 
     
    374365        
    375366         
     367        print "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv  " 
    376368         
    377369        hits = searchClient.hits 
Note: See TracChangeset for help on using the changeset viewer.