changeset 1284:82d1f983bcfb

merged xapian branch
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 15 Aug 2006 11:29:45 +0200
parents ed68b5d6f47e (current diff) e26799c574b0 (diff)
children 1ed1a0ac1715
files
diffstat 3 files changed, 32 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/fullsearch.py	Tue Aug 15 11:21:11 2006 +0200
+++ b/MoinMoin/action/fullsearch.py	Tue Aug 15 11:29:45 2006 +0200
@@ -92,18 +92,27 @@
     # Start content (important for RTL support)
     request.write(request.formatter.startContent("content"))
 
-    # First search stats
-    request.write(results.stats(request, request.formatter, hitsFrom))
+    # Did we get any hits?
+    if results.hits:
+        # First search stats
+        request.write(results.stats(request, request.formatter, hitsFrom))
 
-    # Then search results
-    info = not titlesearch
-    if context:
-        output = results.pageListWithContext(request, request.formatter,
-                info=info, context=context, hitsFrom=hitsFrom)
+        # Then search results
+        info = not titlesearch
+        if context:
+            output = results.pageListWithContext(request, request.formatter,
+                    info=info, context=context, hitsFrom=hitsFrom)
+        else:
+            output = results.pageList(request, request.formatter, info=info,
+                    hitsFrom=hitsFrom)
+        request.write(output)
     else:
-        output = results.pageList(request, request.formatter, info=info,
-                hitsFrom=hitsFrom)
-    request.write(output)
+        f = request.formatter
+        request.write(''.join([
+            f.heading(1, 3),
+            f.text(_('Your search query didn\'t return any results.')),
+            f.heading(0, 3),
+        ]))
 
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)
--- a/MoinMoin/action/info.py	Tue Aug 15 11:21:11 2006 +0200
+++ b/MoinMoin/action/info.py	Tue Aug 15 11:29:45 2006 +0200
@@ -90,7 +90,7 @@
         may_revert = request.user.may.revert(pagename)
 
         def render_action(text, query, **kw):
-            kw.update(rel='nofollow')
+            kw.update(dict(rel='nofollow'))
             if 0: # diff button doesnt work XXX
                 params_html = []
                 for k, v in query.items():
--- a/MoinMoin/macro/SystemInfo.py	Tue Aug 15 11:21:11 2006 +0200
+++ b/MoinMoin/macro/SystemInfo.py	Tue Aug 15 11:29:45 2006 +0200
@@ -115,14 +115,18 @@
     from MoinMoin.search.builtin import Search
     xapState = (_('Disabled'), _('Enabled'))
     idxState = (_('index available'), _('index unavailable'))
-    idx = Search._xapianIndex(request)
-    available = idx and idxState[0] or idxState[1]
-    mtime = _('last modified: %s') % (idx and
-            request.user.getFormattedDateTime(
-                wikiutil.version2timestamp(idx.mtime())) or
-                _('N/A'))
-    row(_('Xapian search'), '%s, %s, %s'
-            % (xapState[request.cfg.xapian_search], available, mtime))
+    xapRow = xapState[request.cfg.xapian_search]
+
+    if request.cfg.xapian_search:
+        idx = Search._xapianIndex(request)
+        available = idx and idxState[0] or idxState[1]
+        mtime = _('last modified: %s') % (idx and
+                request.user.getFormattedDateTime(
+                    wikiutil.version2timestamp(idx.mtime())) or
+                    _('N/A'))
+        xapRow += ', %s, %s' % (available, mtime)
+
+    row(_('Xapian search'), xapRow)
     row(_('Xapian stemming'), xapState[request.cfg.xapian_stemming])
 
     row(_('Active threads'), t_count or _('N/A'))