changeset 1226:9b101f696445

index domains of a page (standard, underlay)
author Franz Pletz <fpletz AT franz-pletz DOT org>
date Sun, 06 Aug 2006 16:58:41 +0200
parents d7d17b4285f5
children 35e021959906
files MoinMoin/search/Xapian.py docs/CHANGES.fpletz
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/Xapian.py	Sun Aug 06 14:33:56 2006 +0200
+++ b/MoinMoin/search/Xapian.py	Sun Aug 06 16:58:41 2006 +0200
@@ -173,6 +173,7 @@
         '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)
+        'domain': 'XDOMAIN', # standard or underlay
                        #Y   year (four digits)
     }
 
@@ -335,6 +336,12 @@
         return [cat.lower()
                 for cat in re.findall(r'Category([^\s]+)', body[pos:])]
 
+    def _get_domains(self, page):
+        if page.isUnderlayPage():
+            yield 'underlay'
+        if page.isStandardPage():
+            yield 'standard'
+
     def _index_page(self, writer, page, mode='update'):
         """ Index a page - assumes that the write lock is acquired
             @arg writer: the index writer object
@@ -351,6 +358,7 @@
         # XXX: Hack until we get proper metadata
         language, stem_language = self._get_languages(page)
         categories = self._get_categories(page)
+        domains = tuple(self._get_domains(page))
         updated = False
 
         if mode == 'update':
@@ -385,6 +393,8 @@
                 xkeywords.append(xapdoc.Keyword('linkto', pagelink))
             for category in categories:
                 xkeywords.append(xapdoc.Keyword('category', category))
+            for domain in domains:
+                xkeywords.append(xapdoc.Keyword('domain', domain))
             xcontent = xapdoc.TextField('content', page.get_raw_body())
             doc = xapdoc.Document(textFields=(xcontent, xtitle),
                                   keywords=xkeywords,
--- a/docs/CHANGES.fpletz	Sun Aug 06 14:33:56 2006 +0200
+++ b/docs/CHANGES.fpletz	Sun Aug 06 16:58:41 2006 +0200
@@ -211,4 +211,5 @@
 2006-08-05 .. 2006-08-06
     * (finally :)) Google-like paging, using images from google.com until
       we get proper moin gfx
+    * index domains of a page (standard, underlay)