Description

The FullSearchWithoutSelf is a small mod from FullSearch. If you use FullSearch in a category-page it will list the page itself also. But that's not what I want. I want a list with all pages in this category, without the category-page itself. That's what FullSearchWithoutSelf will do.

Download & Release Notes

Download

Release Version

Moin Version

Release Notes

FullSearchWithoutSelf.py

1.5

CALLING SEQUENCE

[[FullSearchWithoutSelf]]

Details

# -*- coding: iso-8859-1 -*-
"""
    MoinMoin - FullSearchWithoutSelf Macro

    [[FullSearchWithoutSelf]]
        does the same as clicking on the page title, only that
        the result is embedded into the page and the page itself isn't listed.

"""

import re
from MoinMoin import config, wikiutil, search

Dependencies = ["pages"]

def execute(macro, needle):
    request = macro.request
    _ = request.getText

    needle = '"%s" -title:regex:"^%s$"' % (macro.formatter.page.page_name, macro.formatter.page.page_name)
    needle = needle.strip()

    # Search the pages and return the results
    query = search.QueryParser().parse_query(needle)
    results = search.searchPages(request, query)
    results.sortByPagename()

    return results.pageList(request, macro.formatter)

Author, contact

For comments, please just add a note below - I am subscribed to this page!

Discussion

In category searches, I usually do something like:

[[FullSearch(linkto:MacroMarket/FullSearchWithoutSelf -title:MacroMarket/FullSearchWithoutSelf)]]

No need for a special macro.. :) -- TheAnarcat 2006-05-05 17:52:21

No need for title: modifier in this case. This search is just good enough:

[[FullSearch(linkto:MacroMarket/FullSearchWithoutSelf)]]

This should really call re.escape() on the page_name so that it still works if the page name contains re special characters.

Unless the author of the page added a link to this page on this page. In this case, just delete the self link :-)

MoinMoin: MacroMarket/FullSearchWithoutSelf (last edited 2008-01-29 23:53:51 by JordanCronin)