Jump to main content Jump to doc navigation

Solr searching in SimpleSearch has a few requirements:

  • You are running SimpleSearch version 1.4 or later
  • You have installed the PECL Solr package, which can be found here.
  • You have a running Solr server with an index that can be used for the MODX installation.

If you need more help getting a Solr server installed, the official Solr documentation is quite helpful.

SimpleSearch also provides you with a sample schema.xml for your Solr configuration. You can find it in the following location:

  • core/components/simplesearch/docs/solr.schema.xml

Rename the file to 'schema.xml' and place in your appropriate Solr core's conf/ directory, and then restart Solr.

Those who installed SimpleSearch prior to 1.4.0-pl will need to update their schema.xml file to the latest version (referenced above in the docs/ directory) and reindex all their Resources to take advantage of TV-based searching.

Configuring SimpleSearch to use Solr

Go to System Settings and change the following settings:

  • sisea.driver_class -> Change to "SimpleSearchDriverSolr"
  • sisea.driver_db_specific -> Change to "No", since Solr does not depend on SQL databases

From there, also check to make sure any other Solr-specific configuration options are correct.

If you are running multiple cores in Solr, often your "sisea.solr.path" setting will be something like "solr/corename".

Index Your Existing Resources

From there, you'll need to index your already existing Resources into Solr. Well, SimpleSearch provides you with a utility Snippet for just that! Simply place the "SimpleSearchIndexAll" snippet onto any page, and view the page. (Make sure you've already setup Solr as outlined above first!) The snippet will run, indexing all your existing Resources into the Solr index. After it has run, you should remove the Snippet call.

As you continue to develop your site, SimpleSearch will automatically index Resources as you work on them, via the SimpleSearchIndexer plugin.

That's it! You now have Solr-powered search on your site.

Other Notes

A few SimpleSearch properties do not apply to Solr-based searches. These are:

  • maxWords, useAllWords, searchStyle, fieldPotency, customPackages

These properties on the SimpleSearch snippet will be ignored if you are using Solr search.

Note for 2.1.0-rc4 and Earlier Users

Due to a bug in MODX 2.1.0-rc4 and earlier, you will need to patch the file here:

core/model/modx/processors/resource/unpublish.php

Find the string "OnDocUnpublished" in the invokeEvent call. Replace it with: OnDocUnPublished (note the capital P). This will allow Solr to reindex the Resource if it gets unpublished via the tree.

This issue has been fixed in MODX Revolution 2.1.0-pl and later.

See Also

  1. SimpleSearch.SimpleSearch
    1. SimpleSearch.SimpleSearch.containerTpl
    2. SimpleSearch.SimpleSearch.currentPageTpl
    3. SimpleSearch.SimpleSearch.pageTpl
    4. SimpleSearch.SimpleSearch.tpl
    5. SimpleSearch.Faceted Search Through PostHooks
  2. SimpleSearch.SimpleSearchForm
    1. SimpleSearch.SimpleSearchForm.tpl
  3. SimpleSearch.Solr

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
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • Chris Fickling
  • CrewMark
  • deJaya
  • eydolan
  • Following Sea
  • Lefthandmedia
  • Murray Wood
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • Nick Clark
  • A. Moreno
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

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

Learn more