Jump to main content Jump to doc navigation

What is AdvSearch?

AdvSearch is an advanced search Extra for MODX Revolution. It supports MySQL search, optional Zend Lucene indexing for dynamic content, faceted search, and search in custom packages.

Requirements

  • MODX Revolution 2.0.8 or later (package docs also mention 2.1+)
  • PHP with multibyte string support enabled (use_multibyte / mbstring)
  • UTF-8 charset
  • jQuery (shipped with AdvSearch; current package trees use a newer build than the old 1.5.1 note)
  • For &engine= zend or all only: the ZendSearch Lucene library (see below)

MySQL-only search (&engine= mysql, the default) does not need ZendSearch.

History

AdvSearch was written by Coroico and first released on August 14th, 2011. It is loosely based on AjaxSearch for MODX Evolution by KyleJ/Coroico, with optional Lucene indexing via ZendSearch.

Download

Install from the Manager via Package Management, or download from the Extras repository: https://modx.com/extras/package/advsearch

If you plan to use the Zend Lucene engine, install ZendSearch before you index or search with that engine (see below).

Development and Bug Reporting

Source and issues live on GitHub: https://github.com/coroico/AdvSearch

Installation of ZendSearch (Lucene engine)

Zend Framework became the Laminas Project. Laminas did not take over the Lucene search component. There is no official laminas-search drop-in for AdvSearch.

Current AdvSearch (see advsearch.zend.controller.class.php on the Development branch) loads Composer’s autoloader at:

{libraryPath}ZendSearch/vendor/autoload.php

By default libraryPath resolves to core/components/advsearch/libraries/ (override with the AdvSearch &libraryPath property if you keep libraries elsewhere). After install you need this file:

core/components/advsearch/libraries/ZendSearch/vendor/autoload.php

AdvSearch then uses the \ZendSearch\Lucene\ PHP API.

On the server, from your MODX root (adjust the path if your Extra lives elsewhere):

mkdir -p core/components/advsearch/libraries/ZendSearch
cd core/components/advsearch/libraries/ZendSearch
composer require handcraftedinthealps/zendsearch

handcraftedinthealps/zendsearch is a maintained fork of the abandoned zendframework/zendsearch package. It keeps the \ZendSearch\ namespace AdvSearch expects and targets modern PHP.

You can use composer require zendframework/zendsearch instead if you accept the abandoned upstream package and its older dependency constraints.

Confirm the autoloader exists, then set &engine= to zend or all on your AdvSearch calls and build the Lucene index with AdvSearch’s indexation tools.

Why not full Laminas?

Laminas replaced most Zend Framework components. ZendSearch Lucene was already unmaintained and was not migrated. Dropping a generic Laminas release into assets/libraries/Zend (the old docs path) will not satisfy AdvSearch’s current loader.

Usage

AdvSearch has mainly 2 snippets - one to display a form ("AdvSearchForm") and the other to display search results ("AdvSearch"). A third snippet ("AdvSearchHelp") is used to display a help window for the presentation of the query syntax.

All the templates used by default to set up the form and display the results are provided as chunks. These chunks are installed through the package management.

Examples

Display a search form, and below it, the results:

[[!AdvSearchForm]]

<h2>Results</h2>
[[!AdvSearch]]

Display a Search form that sends you to a results page in Resource 82 (which has the AdvSearch call in it):

[[!AdvSearchForm? &landing=`82`]]

See Also

  1. AdvSearch.AdvSearch
    1. AdvSearch.AdvSearch.containerTpl
    2. Advsearch.AdvSearch.extractTpl
    3. AdvSearch.Advsearch.paging1Tpl
    4. AdvSearch.AdvSearch.paging0Tpl
    5. AdvSearch.AdvSearch.tpl
  2. AdvSearch.AdvSearchForm
    1. Advsearch.AdvSearchForm.tpl
  3. AdvSearch.AdvSearchHelp
    1. AdvSearch.AdvSearchHelp.helplinkTpl

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • Alex
  • A. Moreno
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • deJaya
  • JT Skaggs
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$204 per month—let's make that $500!

Learn more