Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.search.results.FoundAttachment Class Reference
Inheritance diagram for MoinMoin.search.results.FoundAttachment:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.search.results.FoundAttachment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def weight
def add_matches
def get_matches

Public Attributes

 page_name
 attachment
 rev
 page

Private Attributes

 _matches

Detailed Description

Represents an attachment in search results 

Definition at line 188 of file results.py.


Constructor & Destructor Documentation

def MoinMoin.search.results.FoundAttachment.__init__ (   self,
  page_name,
  attachment,
  matches = None,
  page = None,
  rev = 0 
)

Definition at line 191 of file results.py.

00191 
00192     def __init__(self, page_name, attachment, matches=None, page=None, rev=0):
00193         self.page_name = page_name
00194         self.attachment = attachment
00195         self.rev = rev
00196         self.page = page
00197         if matches is None:
00198             matches = []
00199         self._matches = matches


Member Function Documentation

def MoinMoin.search.results.FoundPage.add_matches (   self,
  matches 
) [inherited]
Add found matches 

Definition at line 126 of file results.py.

00126 
00127     def add_matches(self, matches):
00128         """ Add found matches """
00129         self._matches.extend(matches)

def MoinMoin.search.results.FoundPage.get_matches (   self,
  unique = 1,
  sort = 'start',
  type = Match 
) [inherited]
Return all matches of type sorted by sort

@param unique: return only unique matches (bool)
@param sort: match attribute to sort by (string)
@param type: type of match to return (Match or sub class)
@rtype: list
@return: list of matches

Reimplemented in MoinMoin.search.results.FoundRemote.

Definition at line 130 of file results.py.

00130 
00131     def get_matches(self, unique=1, sort='start', type=Match):
00132         """ Return all matches of type sorted by sort
00133 
00134         @param unique: return only unique matches (bool)
00135         @param sort: match attribute to sort by (string)
00136         @param type: type of match to return (Match or sub class)
00137         @rtype: list
00138         @return: list of matches
00139         """
00140         if unique:
00141             matches = self._unique_matches(type=type)
00142             if sort == 'start':
00143                 # matches already sorted by match.start, finished.
00144                 return matches
00145         else:
00146             matches = self._matches
00147 
00148         # Filter by type and sort by sort using fast schwartzian transform.
00149         if sort == 'start':
00150             tmp = [(match.start, match) for match in matches if isinstance(match, type)]
00151         else:
00152             tmp = [(match.weight(), match) for match in matches if isinstance(match, type)]
00153         tmp.sort()
00154         if sort == 'weight':
00155             tmp.reverse()
00156         matches = [item[1] for item in tmp]
00157 
00158         return matches

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search.results.FoundAttachment.weight (   self,
  unique = 1 
)
returns how important this page is for the terms searched for

Summarize the weight of all page matches

@param unique: ignore identical matches
@rtype: int
@return: page weight

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 200 of file results.py.

00200 
00201     def weight(self, unique=1):
00202         return 1
00203 


Member Data Documentation

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 198 of file results.py.

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 193 of file results.py.

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 195 of file results.py.

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 192 of file results.py.

Reimplemented from MoinMoin.search.results.FoundPage.

Definition at line 194 of file results.py.


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