changeset 1206:a9ffe6479012

nicer regexp support for TitleSearch
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Mon, 24 Jul 2006 16:22:29 +0200
parents 73f576c4bca3
children a1c47a57fd01
files MoinMoin/search/Xapian.py MoinMoin/search/builtin.py MoinMoin/search/queryparser.py docs/CHANGES.fpletz
diffstat 4 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/Xapian.py	Mon Jul 24 14:18:55 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Mon Jul 24 16:22:29 2006 +0200
@@ -172,6 +172,7 @@
         'linkto': 'XLINKTO', # this document links to that document
         'stem_lang': 'XSTEMLANG', # ISO Language code this document was stemmed in
         'category': 'XCAT', # category this document belongs to
+        'full_title': 'XFT', # full title (for regex)
                        #Y   year (four digits)
     }
 
@@ -378,7 +379,8 @@
             xtitle = xapdoc.TextField('title', pagename, True) # prefixed
             xkeywords = [xapdoc.Keyword('itemid', itemid),
                     xapdoc.Keyword('lang', language),
-                    xapdoc.Keyword('stem_lang', stem_language)]
+                    xapdoc.Keyword('stem_lang', stem_language),
+                    xapdoc.Keyword('full_title', pagename.lower())]
             for pagelink in page.getPageLinks(request):
                 xkeywords.append(xapdoc.Keyword('linkto', pagelink))
             for category in categories:
--- a/MoinMoin/search/builtin.py	Mon Jul 24 14:18:55 2006 +0200
+++ b/MoinMoin/search/builtin.py	Mon Jul 24 16:22:29 2006 +0200
@@ -169,7 +169,7 @@
         return os.path.getmtime(self.dir)
 
     def touch(self):
-        os.utime(self.dir)
+        os.utime(self.dir, None)
     
     def _search(self, query):
         raise NotImplemented
--- a/MoinMoin/search/queryparser.py	Mon Jul 24 14:18:55 2006 +0200
+++ b/MoinMoin/search/queryparser.py	Mon Jul 24 16:22:29 2006 +0200
@@ -428,8 +428,15 @@
     def xapian_term(self, request, allterms):
         if self.use_re:
             # basic regex matching per term
-            terms = [term for term in allterms() if
-                    self.search_re.findall(term[1:]) and term[0] == 'S']
+            terms = []
+            found = False
+            for term in allterms():
+                if term[:4] == 'XFT:':
+                    found = True
+                    if self.search_re.findall(term[4:]):
+                        terms.append(term)
+                elif found:
+                    break
             if not terms:
                 return Query()
             queries = [Query(Query.OP_OR, terms)]
--- a/docs/CHANGES.fpletz	Mon Jul 24 14:18:55 2006 +0200
+++ b/docs/CHANGES.fpletz	Mon Jul 24 16:22:29 2006 +0200
@@ -195,3 +195,7 @@
             - subpages called Subpage (1st level): re:[^/]*/SubPage
             - subpages called Subpage (last level): re:/Subpage$
 
+2006-07-24
+    * SystemInfo macro update (mtime)
+    * nicer regexp support for TitleSearch
+