Back to index

moin  1.9.0~rc2
Namespaces | Functions | Variables
MoinMoin.search Namespace Reference

Namespaces

namespace  builtin
namespace  queryparser
namespace  results
namespace  Xapian

Functions

def searchPages
def _get_searcher
def _parse_query

Variables

tuple logging = log.getLogger(__name__)

Function Documentation

def MoinMoin.search._get_searcher (   request,
  query,
  sort = 'weight',
  mtime = None,
  historysearch = None,
  kw 
) [private]
Return a searcher object according to the configuration.

Definition at line 38 of file __init__.py.

00038 
00039 def _get_searcher(request, query, sort='weight', mtime=None, historysearch=None, **kw):
00040     """
00041     Return a searcher object according to the configuration.
00042     """
00043     query = _parse_query(query, **kw)
00044     searcher = None
00045 
00046     if request.cfg.xapian_search:
00047         try:
00048             from MoinMoin.search.Xapian.search import XapianSearch, IndexDoesNotExistError
00049             searcher = XapianSearch(request, query, sort, mtime=mtime, historysearch=historysearch)
00050         except ImportError, error:
00051             logging.warning("%s. You should either set xapian_search = False in your wiki config or install/upgrade Xapian." % str(error))
00052         except IndexDoesNotExistError:
00053             logging.warning("Slow moin search is used because the Xapian index does not exist. You should create it using the moin index build command.")
00054 
00055     if searcher is None:
00056         searcher = MoinSearch(request, query, sort, mtime=mtime, historysearch=historysearch)
00057 
00058     return searcher

Here is the call graph for this function:

Here is the caller graph for this function:

def MoinMoin.search._parse_query (   query,
  kw 
) [private]

Definition at line 59 of file __init__.py.

00059 
00060 def _parse_query(query, **kw):
00061     if isinstance(query, str) or isinstance(query, unicode):
00062         query = QueryParser(**kw).parse_query(query)
00063 
00064     return query
00065 

Here is the caller graph for this function:

def MoinMoin.search.searchPages (   request,
  query,
  sort = 'weight',
  mtime = None,
  historysearch = None,
  kw 
)
Search the text of all pages for query.

@param request: current request
@param query: the expression (string or query objects) we want to search for
@keyword sort: sorting of the search results, either 'weight' or 'page_name'
@keyword mtime: only items modified since mtime
@keyword historysearch: include older revisions of items in search
@keyword titlesearch: treat all terms as title searches (passed to qp)
@keyword case: do case sensitive search (passed to qp)
@keyword regex: treat all terms as regular expression (passed to qp)
@rtype: SearchResults instance
@return: search results

Definition at line 20 of file __init__.py.

00020 
00021 def searchPages(request, query, sort='weight', mtime=None, historysearch=None, **kw):
00022     """
00023     Search the text of all pages for query.
00024 
00025     @param request: current request
00026     @param query: the expression (string or query objects) we want to search for
00027     @keyword sort: sorting of the search results, either 'weight' or 'page_name'
00028     @keyword mtime: only items modified since mtime
00029     @keyword historysearch: include older revisions of items in search
00030     @keyword titlesearch: treat all terms as title searches (passed to qp)
00031     @keyword case: do case sensitive search (passed to qp)
00032     @keyword regex: treat all terms as regular expression (passed to qp)
00033     @rtype: SearchResults instance
00034     @return: search results
00035     """
00036     return _get_searcher(request, query, sort, mtime, historysearch, **kw).run()
00037 

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 14 of file __init__.py.