changeset 1493:91f8863f0c13

language search for moinSearch implemented
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Fri, 25 Aug 2006 14:23:30 +0200
parents e0c816e54863
children cdcdab722a96
files MoinMoin/macro/AdvancedSearch.py MoinMoin/search/queryparser.py
diffstat 2 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/AdvancedSearch.py	Fri Aug 25 14:05:32 2006 +0200
+++ b/MoinMoin/macro/AdvancedSearch.py	Fri Aug 25 14:23:30 2006 +0200
@@ -72,7 +72,7 @@
         for lang, lmeta in languages.items()])
     userlang = macro.request.lang
     lang_dropdown = ''.join([
-        u'<select name="language" size="1"%s>' % disabledIfMoinSearch,
+        u'<select name="language" size="1">',
         u'<option value=""%s>%s</option>' %
             (not searchedlang and ' selected' or '', _('any language')),
         ''.join(['<option value="%s"%s>%s</option>' %
--- a/MoinMoin/search/queryparser.py	Fri Aug 25 14:05:32 2006 +0200
+++ b/MoinMoin/search/queryparser.py	Fri Aug 25 14:23:30 2006 +0200
@@ -611,10 +611,19 @@
         return ""
 
     def search(self, page):
-        if not self.xapian_called:
+        match = False
+        body = page.getPageHeader()
+        
+        if re.findall('#language %s' % self.pattern, body):
+            match = True
+
+        # Decide what to do with the results.
+            if self.negated and match:
+            return None
+        elif match or (self.negated and not match):
+            return [Match()]
+        else:
             return []
-        else:
-            return [Match()]
 
     def xapian_wanted(self):
         return True             # only easy regexps possible