changeset 822:47a674c70966

case-insensitive LinkSearch
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Sat, 10 Jun 2006 11:28:36 +0200
parents ea1fc283b742
children 17d66aec432c
files MoinMoin/Xapian.py MoinMoin/search.py
diffstat 2 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/Xapian.py	Sat Jun 10 11:28:27 2006 +0200
+++ b/MoinMoin/Xapian.py	Sat Jun 10 11:28:36 2006 +0200
@@ -491,7 +491,9 @@
         updated = False
 
         if mode == 'update':
-            # from #xapian: if you generate a special "unique id" term, you can just call database.replace_document(uid_term, doc)
+            # from #xapian: if you generate a special "unique id" term,
+            # you can just call database.replace_document(uid_term, doc)
+            # -> done in xapwrap.index.Index.index()
             query = xapidx.RawQuery(xapdoc.makePairForWrite('itemid', itemid))
             docs = writer.search(query, valuesWanted=['pagename', 'attachment', 'mtime', 'wikiname', ])
             if docs:
@@ -514,7 +516,7 @@
             xtitle = xapdoc.TextField('title', pagename, True) # prefixed
             xkeywords = [xapdoc.Keyword('itemid', itemid)]
             for pagelink in page.getPageLinks(request):
-                xkeywords.append(xapdoc.Keyword('linkto', pagelink.lower()))
+                xkeywords.append(xapdoc.Keyword('linkto', pagelink))
             xcontent = xapdoc.TextField('content', page.get_raw_body())
             doc = xapdoc.Document(textFields=(xcontent, xtitle),
                                   keywords=xkeywords,
--- a/MoinMoin/search.py	Sat Jun 10 11:28:27 2006 +0200
+++ b/MoinMoin/search.py	Sat Jun 10 11:28:36 2006 +0200
@@ -10,7 +10,7 @@
     @license: GNU GPL, see COPYING for details
 """
 
-import re, time, sys, StringIO, operator
+import re, time, sys, StringIO, string
 from MoinMoin import wikiutil, config
 from MoinMoin.Page import Page
 
@@ -436,7 +436,7 @@
         Found = True
         
         for link in page.getPageLinks(page.request):
-            if ((self.static and self.pattern.lower() == link.lower()) or
+            if ((self.static and self.pattern == link) or
                 (not self.static and self.search_re.match(link))):
                 break
         else:
@@ -468,9 +468,10 @@
         if self.use_re:
             return None # xapian doesnt support regex search
         else:
-            term = xapian.Query(('%s%s' %
+            term = xapian.Query(('%s%s%s' %
                 (Xapian.Index.prefixMap['linkto'],
-                    pattern.lower())).encode(config.charset))
+                    pattern[0] in string.uppercase and ':' or '',
+                    pattern)).encode(config.charset))
             return term
 
 ############################################################################