changeset 1449:e219092e1a0d

a few small fixes to get misc things working with xapian
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Mon, 21 Aug 2006 19:03:20 +0200
parents 4012f0814295
children 522339274505
files MoinMoin/action/fullsearch.py MoinMoin/macro/AdvancedSearch.py MoinMoin/macro/FullSearch.py MoinMoin/macro/__init__.py MoinMoin/search/results.py
diffstat 5 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/fullsearch.py	Mon Aug 21 18:16:15 2006 +0200
+++ b/MoinMoin/action/fullsearch.py	Mon Aug 21 19:03:20 2006 +0200
@@ -75,7 +75,7 @@
         nosystempages = request.form.get('nosystempages', [0])[0]
         historysearch = request.form.get('historysearch', [0])[0]
 
-        mtime = request.form.get('mtime', [''])[0]
+        mtime = request.form.get('mtime', [None])[0]
         if mtime:
             cal = Calendar()
             mtime_parsed = cal.parse(mtime)
--- a/MoinMoin/macro/AdvancedSearch.py	Mon Aug 21 18:16:15 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Mon Aug 21 19:03:20 2006 +0200
@@ -56,8 +56,7 @@
 
     langs = dict([(lang, lmeta['x-language-in-english'])
         for lang, lmeta in languages.items()])
-    userlang = macro.request.user.language or \
-            macro.request.cfg.language_default
+    userlang = macro.request.lang
     lang_dropdown = ''.join([
         u'<select name="language" size="1">',
         u'<option value="" selected>%s</option>' % _('any language'),
--- a/MoinMoin/macro/FullSearch.py	Mon Aug 21 18:16:15 2006 +0200
+++ b/MoinMoin/macro/FullSearch.py	Mon Aug 21 19:03:20 2006 +0200
@@ -105,8 +105,7 @@
     needle = needle.strip()
 
     # Search the pages and return the results
-    results = search.searchPages(request, needle)
-    results.sortByPagename()
+    results = search.searchPages(request, needle, sort='page_name')
 
     return results.pageList(request, macro.formatter, paging=False)
 
--- a/MoinMoin/macro/__init__.py	Mon Aug 21 18:16:15 2006 +0200
+++ b/MoinMoin/macro/__init__.py	Mon Aug 21 19:03:20 2006 +0200
@@ -280,8 +280,7 @@
         # Return a title search for needle, sorted by name.
         # XXX: what's with literal?
         results = search.searchPages(self.request, needle,
-                titlesearch=1, case=case)
-        results.sortByPagename()
+                titlesearch=1, case=case, sort='page_name')
         return results.pageList(self.request, self.formatter, paging=False)
 
     def _macro_InterWiki(self, args):
--- a/MoinMoin/search/results.py	Mon Aug 21 18:16:15 2006 +0200
+++ b/MoinMoin/search/results.py	Mon Aug 21 19:03:20 2006 +0200
@@ -721,10 +721,15 @@
     def formatHitInfoBar(self, page):
         f = self.formatter
         _ = self.request.getText
+
+        rev = page.page.get_real_rev()
+        if rev is None:
+            rev = 0
+
         return ''.join([
             f.paragraph(1, attr={'class': 'searchhitinfobar'}),
             f.text('%.1fk - ' % (page.page.size()/1024.0)),
-            f.text('rev: %d %s- ' % (int(page.page.get_real_rev()),
+            f.text('rev: %d %s- ' % (rev,
                 not page.page.rev and '(%s) ' % _('current') or '')),
             f.text('last modified: %(time)s' % page.page.lastEditInfo()),
             # XXX: proper metadata