changeset 417:d49d08bb5f50

merged whoosh repo
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 07 Aug 2011 15:06:40 +0200
parents ef401198ebf9 (current diff) 6f6a29825a1e (diff)
children e362e7abfda6
files MoinMoin/storage/backends/indexing.py
diffstat 3 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/index.py	Sun Aug 07 03:24:56 2011 +0200
+++ b/MoinMoin/script/maint/index.py	Sun Aug 07 15:06:40 2011 +0200
@@ -34,9 +34,9 @@
     description = 'Build indexes'
 
     option_list = (
-        Option('--for', required=True, dest='indexname', type=str, choices=("all-revs", "latest-revs", "both"), 
+        Option('--for', required=True, dest='indexname', type=str, choices=("all-revs", "latest-revs", "both"),
             help='For what type of indexes we will use action'),
-        Option('--action', required=True, dest='action', type=str, choices=("build", "update", "clean", "move", "show"), 
+        Option('--action', required=True, dest='action', type=str, choices=("build", "update", "clean", "move", "show"),
             help="""
                   Action for given indexes:
                   build -- Build in index_dir_tmp
@@ -238,6 +238,6 @@
         if indexname == "both":
             do_action(action, both_indexnames_schemas)
         elif indexname == "all-revs":
-            do_action(action, (all_indexname_schema,))
+            do_action(action, (all_indexname_schema, ))
         elif indexname == "latest-revs":
-            do_action(action, (latest_indexname_schema,))
+            do_action(action, (latest_indexname_schema, ))
--- a/MoinMoin/search/analyzers.py	Sun Aug 07 03:24:56 2011 +0200
+++ b/MoinMoin/search/analyzers.py	Sun Aug 07 15:06:40 2011 +0200
@@ -100,7 +100,7 @@
                 yield tk
 
 def item_name_analyzer():
-    """ 
+    """
     Calls tokenizer
 
     Input: "some item name", "SomeItem/SubItem", "GSOC2011"
--- a/MoinMoin/storage/backends/indexing.py	Sun Aug 07 03:24:56 2011 +0200
+++ b/MoinMoin/storage/backends/indexing.py	Sun Aug 07 15:06:40 2011 +0200
@@ -197,7 +197,6 @@
     # TODO maybe use this class later for data indexing also,
     # TODO by intercepting write() to index data written to a revision
 
-
 from whoosh.writing import AsyncWriter
 from MoinMoin.search.indexing import WhooshIndex
 
@@ -306,7 +305,8 @@
                                                   )
             else:
                 docs = all_revs_searcher.documents(wikiname=self.wikiname)
-            for doc in sorted(docs, reverse=reverse)[start:end]:
+            from operator import itemgetter
+            for doc in sorted(docs, key=itemgetter("mtime", "rev_no"), reverse=reverse)[start:end]:
                 yield (doc[MTIME], mountpoint + doc[NAME], doc["rev_no"])
 
     def all_tags(self):