Back to index

plone3  3.1.7
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
AdvancedQuery.ranking._RankByQueries Class Reference
Inheritance diagram for AdvancedQuery.ranking._RankByQueries:
Inheritance graph
Collaboration diagram for AdvancedQuery.ranking._RankByQueries:
Collaboration graph

List of all members.

Public Member Functions

def __init__
def getQueryValueSum

Private Member Functions

def _getValueQuerySequence
def _prepare

Private Attributes


Static Private Attributes

 _RankerClass = None

Detailed Description

Ranking specification base class for rankings based on a sequence of (*query*, *value*) pairs.

All values must be non negative numbers.

Definition at line 36 of file

Constructor & Destructor Documentation

def AdvancedQuery.ranking._RankByQueries.__init__ (   self,
each spec is a pair *query*, *value*.

Reimplemented in AdvancedQuery.ranking.RankByQueries_Max.

Definition at line 44 of file

00045   def __init__(self, *specs):
00046     '''each spec is a pair *query*, *value*.'''
00047     l = []; sum = 0
00048     for q,v in specs:
00049       if not isinstance(q, _BaseQuery):
00050         raise TypeError('Query must be an AdvancedQuery')
00051       if not isinstance(v, (int, float, long)):
00052         raise TypeError('Query value must be a float')
00053       if v < 0: raise ValueError('Query value must not be negative')
00054       if not v: continue
00055       l.append((v,q)); sum += v
00056     l.sort()
00057     self._specs = l; self._sum = sum

Here is the caller graph for this function:

Member Function Documentation

Definition at line 59 of file

00060   def _getValueQuerySequence(self): return self._specs

def AdvancedQuery.ranking._RankByQueries._prepare (   self,
) [private]
return a sorter using *cat*.

Reimplemented from AdvancedQuery.ranking.RankSpec.

Definition at line 61 of file

00062   def _prepare(self, cat):
00063     return self._RankerClass(self, cat)

Definition at line 58 of file

  def getQueryValueSum(self): return self._sum

Member Data Documentation

Reimplemented in AdvancedQuery.ranking.RankByQueries_Max.

Definition at line 56 of file

Definition at line 56 of file

The documentation for this class was generated from the following file: