changeset 2071:45da3fcc47f8

Add 'mimetypes_to_index_as_empty' config option. This is a bandaid because the 'pdfminer' PDF indexer can take a *very* long time. In principle, that is the issue that would need to be fixed, but this config option (which should realistically default to ['application/pdf'] helps keep moin usable in the meantime.
author Andreas Kloeckner <inform@tiker.net>
date Sun, 24 Mar 2013 19:28:53 -0500
parents b955b06ac0cf
children ab2421ef4897
files MoinMoin/config/default.py MoinMoin/storage/middleware/indexing.py
diffstat 2 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/default.py	Sat Mar 23 21:38:07 2013 -0500
+++ b/MoinMoin/config/default.py	Sun Mar 24 19:28:53 2013 -0500
@@ -451,6 +451,8 @@
         ('create_index', False, "Create (initialize) the index before trying to use them."),
         ('destroy_storage', False, "Destroy (empty) the storage backends after using them."),
         ('destroy_index', False, "Destroy (empty) the index after using it."),
+
+        ('mimetypes_to_index_as_empty', [], "List of mimetypes which are indexed as though they were empty."),
     )),
     # ==========================================================================
     'items': ('Special Item Names', None, (
--- a/MoinMoin/storage/middleware/indexing.py	Sat Mar 23 21:38:07 2013 -0500
+++ b/MoinMoin/storage/middleware/indexing.py	Sun Mar 24 19:28:53 2013 -0500
@@ -193,6 +193,10 @@
         def tell(self, *args, **kw):
             return self.data.tell(*args, **kw)
 
+    if meta[CONTENTTYPE] in app.cfg.mimetypes_to_index_as_empty:
+        print "SKIPPING", meta[NAME]
+        return u''
+
     if not item_name:
         item_name = get_names(meta)[0]