changeset 1466:500e043cf7cd

code documentation update
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Wed, 23 Aug 2006 16:15:08 +0200
parents f61493ff5e10
children 26c8ab85dc86
files MoinMoin/search/__init__.py MoinMoin/search/builtin.py
diffstat 2 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/__init__.py	Wed Aug 23 14:38:24 2006 +0200
+++ b/MoinMoin/search/__init__.py	Wed Aug 23 16:15:08 2006 +0200
@@ -19,6 +19,12 @@
     
     @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
     """
--- a/MoinMoin/search/builtin.py	Wed Aug 23 14:38:24 2006 +0200
+++ b/MoinMoin/search/builtin.py	Wed Aug 23 16:15:08 2006 +0200
@@ -136,10 +136,15 @@
                 raise
 
 class BaseIndex:
+    """ Represents a search engine index """
+
     class LockedException(Exception):
         pass
 
     def __init__(self, request):
+        """
+        @param request: current request
+        """
         self.request = request
         cache_dir = request.cfg.cache_dir
         main_dir = self._main_dir()
@@ -166,24 +171,34 @@
         return os.path.exists(self.sig_file)
                 
     def mtime(self):
+        """ Modification time of the index """
         return os.path.getmtime(self.dir)
 
     def touch(self):
+        """ Touch the index """
         os.utime(self.dir, None)
     
     def _search(self, query):
         raise NotImplemented('...')
 
-    def search(self, query, *args, **kw):
+    def search(self, query, **kw):
+        """ Search for items in the index
+        
+        @param query: the query to pass to the index
+        """
         #if not self.read_lock.acquire(1.0):
         #    raise self.LockedException
         #try:
-        hits = self._search(query, *args, **kw)
+        hits = self._search(query, **kw)
         #finally:
         #    self.read_lock.release()
         return hits
 
     def update_page(self, page):
+        """ Update a single page in the index
+
+        @param page: the page object to update
+        """
         self.queue.append(page.page_name)
         self._do_queued_updates_InNewThread()
 
@@ -193,6 +208,7 @@
         Can be called only from a script. To index pages during a user
         request, use indexPagesInNewThread.
         @arg files: iterator or list of files to index additionally
+        @keyword mode: set the mode of indexing the pages, either 'update', 'add' or 'rebuild'
         """
         if not self.lock.acquire(1.0):
             self.request.log("can't index: can't acquire lock")