changeset 1522:98b68b87a6f1

fix mimetype selection and showing attachment matches
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Sun, 27 Aug 2006 16:22:18 +0200
parents 6cd9bcede8cf
children 2f4c0bc79175
files MoinMoin/macro/AdvancedSearch.py MoinMoin/search/Xapian.py MoinMoin/search/builtin.py MoinMoin/search/results.py
diffstat 4 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/AdvancedSearch.py	Sun Aug 27 00:07:47 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Sun Aug 27 16:22:18 2006 +0200
@@ -89,7 +89,7 @@
     # mimetype selection
     mimetype = form_get(request, 'mimetype')
     mt_select = makeSelection('mimetype',
-            [(m[1], '*%s - %s' % m) for m in sorted(mimetypes.types_map.items())],
+            [('', 'any mimetype')] + [(m[1], '*%s - %s' % m) for m in sorted(mimetypes.types_map.items())],
             mimetype)
 
 
--- a/MoinMoin/search/Xapian.py	Sun Aug 27 00:07:47 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Sun Aug 27 16:22:18 2006 +0200
@@ -546,6 +546,7 @@
             if updated:
                 xatt_itemid = xapdoc.Keyword('itemid', att_itemid)
                 xpname = xapdoc.SortKey('pagename', pagename)
+                xwname = xapdoc.SortKey('wikiname', request.cfg.interwikiname or "Self")
                 xattachment = xapdoc.SortKey('attachment', att) # this is an attachment, store its filename
                 xmtime = xapdoc.SortKey('mtime', mtime)
                 xrev = xapdoc.SortKey('revision', '0')
--- a/MoinMoin/search/builtin.py	Sun Aug 27 00:07:47 2006 +0200
+++ b/MoinMoin/search/builtin.py	Sun Aug 27 16:22:18 2006 +0200
@@ -610,7 +610,8 @@
         
         @param page: the current page instance
         """
-        return self.query.search(page)
+        if page:
+            return self.query.search(page)
 
     def _getHits(self, pages, matchSearchFunction):
         """ Get the hit tuples in pages through matchSearchFunction """
@@ -644,7 +645,8 @@
                         page = Page(self.request, "%s/%s" % (fs_rootpage, attachment))
                         hits.append((wikiname, page, None, None))
                     else:
-                        hits.append((wikiname, page, attachment, None))
+                        matches = matchSearchFunction(page=None, uid=uid)
+                        hits.append((wikiname, page, attachment, matches))
                 else:
                     matches = matchSearchFunction(page=page, uid=uid)
                     if matches:
--- a/MoinMoin/search/results.py	Sun Aug 27 00:07:47 2006 +0200
+++ b/MoinMoin/search/results.py	Sun Aug 27 16:22:18 2006 +0200
@@ -194,12 +194,6 @@
     def weight(self, unique=1):
         return 1
 
-    def get_matches(self, unique=1, sort='start', type=Match):
-        return []
-
-    def _unique_matches(self, type=Match):
-        return []
-
 
 class FoundRemote(FoundPage):
     """ Represents an attachment in search results """
@@ -821,7 +815,7 @@
         if wikiname in (request.cfg.interwikiname, 'Self'): # a local match
             if attachment:
                 result_hits.append(FoundAttachment(page.page_name,
-                    attachment, page=page))
+                    attachment, page=page, matches=match))
             else:
                 result_hits.append(FoundPage(page.page_name, match, page))
         else: