Misago
  • Introduction
  • Setup
    • Create server on Digital Ocean
    • Point domain at your server
    • Setup Misago on your Server
    • Upgrading your Misago to latest version
  • Settings
    • Accessing settings
    • Static settings reference
    • Dynamic settings reference
  • Coding style
  • GDPR Compliance Guide
  • Social authentication
  • User rank styles
  • Category styles
  • User authentication
  • Writing new admin actions
  • Permissions framework
  • View decorators
  • Context processors
  • Frontend context
  • Audit trail
  • Forms
  • Cache
  • Sending mails
  • Markup
  • Posting process
  • Profile fields
  • Threads types
  • Extending pages
  • Validating registrations
  • Validators
  • Search filters
  • Template tags
  • Shortcuts
  • View errors
  • Locales
Powered by GitBook
On this page

Search filters

Misago implements small feature that allows forum administrators to define custom search filters that may be used to improve forum searches accuracy without need for developing custom dictionaries.

Consider the scenario in which community is ran for computer game. This game's community will eventually develop jargon of its own that will likely confuse the search engine backed by language's dictionary.

In Misago this situation may be easily solved with custom search filters that post and search queries are passed through before they are sent to search engine. Those filters are simple python functions that take string as only argument, do something with it, and then return changed string back, like this:

def my_search_filter(search):
    """very basic filter that lets search engine understand what MMM stands for"""
    return search.replace('MMM', 'Marines, Medics and Marauders')

Misago is made aware of search filters by specifying paths to callables in MISAGO_POST_SEARCH_FILTERS setting, like this:

MISAGO_POST_SEARCH_FILTERS = [
    'myforumsearch.filters.my_search_filter',
]
PreviousValidatorsNextTemplate tags

Last updated 7 years ago