MonsterSearch — Smarter Manager Search for MODX

What is MonsterSearch?

MonsterSearch is a lightweight MODX Manager plugin that supercharges the built-in quick search. It interprets short search operators (prefixes and symbols), handles exact-name queries using quotes, and allows for direct ID filtering.

The idea sparked from a daily frustration: whenever I double-clicked a Chunk or snippet tag like [[$head]], MODX copied the $ symbol too. Pasting $head into the Manager search returned nothing, because the native search couldn't handle the symbol.

MonsterSearch fixes that. Now, you can copy and paste element tags exactly as they appear, and the search instantly finds the right item.

As projects grow and gather hundreds of Chunks, Snippets, Templates, and Resources, finding things becomes a headache. MonsterSearch solves this by delivering precise, flexible, and lightning-fast results directly inside the Manager interface.

Key Features

  • Wildcard prefixes — scope your search results to display exactly what you need.
    $ = Chunks (e.g., $head displays all Chunks with head in their name)
    ! = Snippets (e.g., !pdoCall displays all Snippets with pdoCall in their name)
    * = TVs (e.g., *mainImage displays all TVs with mainImage in their name)
    + = Templates (e.g., +mainTemplate displays all Templates with mainTemplate in their name)
    @ = Plugins (e.g., @migx displays all Plugins with migx in their name)
    # = Resources (e.g., #index displays all Resources with index in their alias or title)
    ^ = Users (e.g., ^admin displays all Users with admin in their username)
    ~ = ID (e.g., ~11 displays only the item with ID 11)
    "Footer Snippet" → Displays the exact element with that name, bypassing fuzzy logic (quoted exact-match search)

    Combined Examples — string operators together for ultimate precision.
    !~21 → Displays only the Snippet with ID 21 (combines ! for Snippets and ~ for exact ID)
    $@ header → Displays Chunks and Plugins containing header in their name (multiple include prefixes)
    +"main layout" → Displays Templates named exactly main layout (Template prefix + quoted exact search)

  • Include & Exclude — mix multiple prefixes or exclude types entirely using a minus sign (e.g., footer -* -@).
  • Fuzzy Search — utilizes the Levenshtein distance algorithm to handle typos gracefully. (Configurable via System Settings).
  • MODX 2.x & 3.x — fully compatible with both Manager architectures.

Installation (quick)

  1. Install the transport package via Package Manager.
  2. Go to System Settings → choose the monstersearch namespace.
  3. Tweak the defaults: monstersearch.wildcards, monstersearch.fuzzy_threshold.
  4. Clear the site cache and reload the Manager.
Default System Settings
                    $==chunks||!==snippets||*==tvs||+==templates||@==plugins||#==resources||^==users
                

MonsterSearch 1.0 Architectural Summary

  • 1. Initialization & Context Check

    Verifies the existence of MODX and strictly ensures execution only within the mgr (Manager) context to prevent frontend interference.

  • 2. OnHandleRequest Event (PHP Absolute Interceptor)
    • ID Search Override: Looks for the monster_id GET parameter. If present, it completely bypasses native MODX search.
    • Direct Database Querying: Uses xPDO/newQuery to search precisely by ID (exact or partial) across multiple tables (Resources, Chunks, Snippets, TVs, Templates, Plugins, Users).
    • Field Mapping: Ensures correct data extraction (e.g., handles the fact that Resources use pagetitle while Chunks use name).
    • JSON Payload: Bypasses standard MODX rendering, outputs the exact JSON structure expected by ExtJS, and halts execution (exit;).
    • Standard Search Limit Hack: If it's a regular text search, it intercepts the request and forces top_search_results_limit to 10000 to prevent MODX from truncating results before JS processing.
  • 3. JavaScript Configuration Bridge

    Reads the monstersearch.wildcards and monstersearch.fuzzy_threshold System Settings, formats them, and injects them securely as a JSON object into the Manager's DOM.

  • 4. JavaScript Parsing Engine (Client-Side)
    • Query Extraction: Separates exact matches (quotes), ID searches (~ prefix or raw numbers), inclusion prefixes (e.g., $, !), and exclusion prefixes (e.g., -*).
    • Exact ID Detection: Detects if an ID search contains a trailing space to trigger strict exact matching vs. partial matching.
  • 5. Ext.Ajax.request Interception (Pre-flight)

    Overrides ExtJS core AJAX methods. When a search action is detected, it parses the query, modifies the payload to request 10,000 results, and appends custom flags (monster_id, monster_exact_id) for the PHP interceptor to catch.

  • 6. Ext.data.Connection Interception (Post-flight)
    • Result Filtering: Receives the massive JSON payload from MODX before it renders on screen.
    • Type & ID Validation: Filters out items that don't match the requested prefixes or IDs.
    • Fuzzy Logic Application: Applies the Levenshtein distance algorithm to find close matches for text queries, adhering to the fuzzy_threshold setting.
    • Deduplication & Sorting: Removes duplicate entries and scores results based on exactness, ordering the final array before passing it back to the ExtJS UI for rendering.
ModX MonsterSearch screenshot
Extra Details
  • Version: 1.0.0
  • Author: Yanni Sanmiguel
  • PHP: 7.4+ (8.1+ recommended)
  • MODX: 2.8.6+ & 3.x
Download / Install Report Issues
License

MonsterSearch is free to use for personal and commercial projects.
You may install it on unlimited domains, including local and staging environments.

Redistribution, resale, or rebranding of this package is not permitted.
Please keep attribution to the original author.

The software is provided “as is”, without any warranties or guarantees of fitness for a particular purpose.
Use at your own risk.

If you find MonsterSearch useful, consider supporting its continued development.
I have many ideas for new MODX tools and apps — your support helps me keep creating and improving tools for everyone.

Support development
Need help?

Have questions or need assistance? Feel free to reach out anytime.

Contact Me
© MonsterSearch — Made by Yanni Sanmiguel