changeset 858:3183a202d916 storage-ng

fix searchform
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 24 Sep 2011 18:52:46 +0200
parents d90218b64094
children 95d1033b7808
files MoinMoin/apps/frontend/views.py MoinMoin/storage/middleware/protecting.py
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/apps/frontend/views.py	Sat Sep 24 03:40:38 2011 +0200
+++ b/MoinMoin/apps/frontend/views.py	Sat Sep 24 18:52:46 2011 +0200
@@ -155,7 +155,7 @@
         history = bool(request.values.get('history'))
         qp = flaskg.storage.query_parser([NAME_EXACT, NAME, CONTENT], all_revs=history)
         q = qp.parse(query)
-        with flaskg.storage.searcher(all_revs=history) as searcher:
+        with flaskg.storage.get_index(all_revs=history).searcher() as searcher:
             flaskg.clock.start('search')
             results = searcher.search(q, limit=100)
             flaskg.clock.stop('search')
@@ -221,7 +221,7 @@
                               data_rendered=Markup(item._render_data()),
                               show_revision=show_revision,
                               show_navigation=show_navigation,
-                              #search_form=SearchForm.from_defaults(),
+                              search_form=SearchForm.from_defaults(),
                              )
     return Response(content, status)
 
@@ -704,7 +704,7 @@
     """
     q = And([Term(WIKINAME, app.cfg.interwikiname),
              Or([Term(ITEMTRANSCLUSIONS, item_name), Term(ITEMLINKS, item_name)])])
-    docs = flaskg.storage.search(q, all_revs=False)
+    docs = flaskg.storage.get_index(all_revs=False).search(q)
     return [doc[NAME] for doc in docs]
 
 
--- a/MoinMoin/storage/middleware/protecting.py	Sat Sep 24 03:40:38 2011 +0200
+++ b/MoinMoin/storage/middleware/protecting.py	Sat Sep 24 18:52:46 2011 +0200
@@ -46,6 +46,12 @@
         else:
             raise ValueError('No acl_mapping entry found for item %r' % itemname)
 
+    def get_index(self, all_revs=False):
+        return self.indexer.get_index(all_revs=all_revs)
+
+    def query_parser(self, default_fields, all_revs=False):
+        return self.indexer.query_parser(default_fields, all_revs=False)
+
     def search(self, q, all_revs=False, **kw):
         for rev in self.indexer.search(q, all_revs, **kw):
             rev = ProtectedRevision(self, rev)