Back to index

moin  1.9.0~rc2
Classes | Functions
MoinMoin.search.results Namespace Reference

Classes

class  Match
 Results. More...
class  TextMatch
class  TitleMatch
class  AttachmentMatch
class  FoundPage
class  FoundAttachment
class  FoundRemote
class  SearchResults

Functions

def getSearchResults

Function Documentation

def MoinMoin.search.results.getSearchResults (   request,
  query,
  hits,
  start,
  sort,
  estimated_hits 
)
Return a SearchResults object with the specified properties

@param request: current request
@param query: the search query object tree
@param hits: list of hits
@param start: position to start showing the hits
@param sort: sorting of the results, either 'weight' or 'page_name'
@param estimated_hits: if true, use this estimated hit count

Definition at line 812 of file results.py.

00812 
00813 def getSearchResults(request, query, hits, start, sort, estimated_hits):
00814     """ Return a SearchResults object with the specified properties
00815 
00816     @param request: current request
00817     @param query: the search query object tree
00818     @param hits: list of hits
00819     @param start: position to start showing the hits
00820     @param sort: sorting of the results, either 'weight' or 'page_name'
00821     @param estimated_hits: if true, use this estimated hit count
00822     """
00823     result_hits = []
00824     for wikiname, page, attachment, match, rev in hits:
00825         if wikiname in (request.cfg.interwikiname, 'Self'): # a local match
00826             if attachment:
00827                 result_hits.append(FoundAttachment(page.page_name, attachment, matches=match, page=page, rev=rev))
00828             else:
00829                 result_hits.append(FoundPage(page.page_name, matches=match, page=page, rev=rev))
00830         else:
00831             page_name = page # for remote wikis, we have the page_name, not the page obj
00832             result_hits.append(FoundRemote(wikiname, page_name, attachment, matches=match, rev=rev))
00833     elapsed = time.time() - start
00834     count = request.rootpage.getPageCount()
00835     return SearchResults(query, result_hits, count, elapsed, sort,
00836             estimated_hits)
00837 

Here is the caller graph for this function: