changeset 1377:bb37beca7545

fixed system pages search, added underlay search, started with mtime filtering
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Sun, 20 Aug 2006 00:14:25 +0200
parents 649b60a4064a
children fa0b7d2d998b
files MoinMoin/action/fullsearch.py MoinMoin/macro/AdvancedSearch.py MoinMoin/search/Xapian.py MoinMoin/search/queryparser.py
diffstat 4 files changed, 20 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/fullsearch.py	Sat Aug 19 13:35:49 2006 +0200
+++ b/MoinMoin/action/fullsearch.py	Sun Aug 20 00:14:25 2006 +0200
@@ -67,7 +67,9 @@
         language = request.form.get('language',
                 [request.cfg.language_default])[0]
         mimetype = request.form.get('mimetype', [0])[0]
-        underlay = request.form.get('underlay', [0])[0]
+        includeunderlay = request.form.get('includeunderlay', [0])[0]
+        onlysystempages = request.form.get('onlysystempages', [0])[0]
+        mtime = request.form.get('mtime', [''])[0]
         
         word_re = re.compile(r'(\"[\w\s]+"|\w+)')
         needle = ''
@@ -75,8 +77,12 @@
             needle += 'language:%s ' % language
         if mimetype:
             needle += 'mimetype:%s ' % mimetype
-        if underlay:
-            needle += 'domain:underlay '
+        if not includeunderlay:
+            needle += '-domain:underlay '
+        if onlysystempages:
+            needle += 'domain:system '
+        if mtime:
+            needle += 'lastmodifiedsince:%s ' % mtime
         if categories:
             needle += '(%s) ' % ' or '.join(['category:%s' % cat
                 for cat in word_re.findall(categories)])
--- a/MoinMoin/macro/AdvancedSearch.py	Sat Aug 19 13:35:49 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Sun Aug 20 00:14:25 2006 +0200
@@ -55,8 +55,8 @@
             # TODO: dropdown-box?
             (_('belonging to one of the following categories'),
                 '<input type="text" name="categories" size="30">'),
-            (_('edited in the the following timeframe (XXX)'),
-                '<input type="text" name="time" size="30" value="until now">'),
+            (_('last modified since (XXX)'),
+                '<input type="text" name="mtime" size="30" value="">'),
         )])
     ])
 
@@ -95,7 +95,9 @@
                 _('Search only in titles')),
                 ('', '<input type="checkbox" name="case" value="1">%s</input>' %
                 _('Case-sensitive search')),
-                ('', '<input type="checkbox" name="underlay" value="1">%s'
+                ('', '<input type="checkbox" name="includeunderlay" value="1" checked>%s'
+                    '</input>' % _('Include underlay')),
+                ('', '<input type="checkbox" name="onlysystempages" value="1">%s'
                     '</input>' % _('Only system pages')),
             )
     ])
--- a/MoinMoin/search/Xapian.py	Sat Aug 19 13:35:49 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Sun Aug 20 00:14:25 2006 +0200
@@ -351,6 +351,8 @@
             yield 'underlay'
         if page.isStandardPage():
             yield 'standard'
+        if wikiutil.isSystemPage(self.request, page.page_name):
+            yield 'system'
 
     def _index_page(self, writer, page, mode='update'):
         """ Index a page - assumes that the write lock is acquired
@@ -402,7 +404,8 @@
                     xapdoc.Keyword('stem_lang', stem_language),
                     xapdoc.Keyword('full_title', pagename.lower()),
                     xapdoc.Keyword('revision', revision),
-                    xapdoc.Keyword('author', author)]
+                    xapdoc.Keyword('author', author),
+                )]
             for pagelink in page.getPageLinks(request):
                 xkeywords.append(xapdoc.Keyword('linkto', pagelink))
             for category in categories:
@@ -462,7 +465,7 @@
                 doc = xapdoc.Document(textFields=(xcontent, ),
                                       keywords=(xatt_itemid, xtitle,
                                           xlanguage, xstem_language,
-                                          xmimetype),
+                                          xmimetype, ),
                                       sortFields=(xpname, xattachment, xmtime,
                                           xwname, ),
                                      )
--- a/MoinMoin/search/queryparser.py	Sat Aug 19 13:35:49 2006 +0200
+++ b/MoinMoin/search/queryparser.py	Sun Aug 20 00:14:25 2006 +0200
@@ -764,7 +764,7 @@
     """ Search for pages belonging to a specific domain """
 
     def __init__(self, pattern, use_re=False, case=True):
-        """ Init a mimetype search
+        """ Init a domain search
 
         @param pattern: pattern to search for, ascii string or unicode
         @param use_re: treat pattern as re of plain text, bool
@@ -824,8 +824,6 @@
             return UnicodeQuery('%s:%s' % (prefix, pattern))
 
 
-
-
 ##############################################################################
 ### Parse Query
 ##############################################################################