Product support

Get help in the plugin support forum.


This OctoberCMS plugin provides an interface with Solarium for indexing, searching and displaying results.

  • keyword search
  • facet
  • pagination
  • index api
  • ...


This OctoberCMS plugin provides an interface with Solarium for indexing, searching and displaying results.


A Solr instance must be accessible (https://lucene.apache.org/solr/); check Solarium PHP Solr client library own requirements (https://github.com/solariumphp/solarium).


A default search index class for Rainlab Static Pages is provided. Just copy and adapt the enclosed config/solr.php file into the OctoberCMS root dir (e.g.: src/config/solr.php).

Index your content using the artisan solr:update_index (see Artisan console tools below).

Add the solrSearch component to a page (https://octobercms.com/docs/cms/components).

solrSearch component

The solrSearch component defines the following properties:

1. pageSize

No comments...

2. facetFields

Insert Solr fields separated by comma(s) to be used as facet. To define a pivot, combines Solr fields by separating them with a dash.


facetFields = "type_label_str,datatype_category_str-datatype_str,categories_str"

3. urlQueryStringFilter

Pass an url with query string (or only the query string part) that apply the desired filter.


urlQueryStringFilter = "q=med&facets%5Btype_label_str%3AData+Source%5D=type_label_str%3A%22Data+Source%22"

Warning: double quote must be escaped as %22.

4. edismaxOptions

Set edismax options (which includes dismax) one by line. See Solarium PHP DisMax component.


queryfields=title_txt_en^1 _text_txt_en


title = "Search"
url = "/search/"
layout = "simple-page"
is_hidden = 0

pageSize = 10
facetFields = "type_label_str,datatype_category_str-datatype_str,categories_str"
{% component 'solrSearch' %}


Here are the available Artisan console tools:

 solr:empty_index   Empty the Solr server search index.
 solr:ping          Check the connection to the Solr server and the health of the Solr server.
 solr:update_index  Update the Solr server search index.

Implements a indexer

To index alternate content you need to implements the \Trepmag\Solr\Classes\SearchIndex class.

As an example see the existing one for the Rainlab Static Pages content in classes/SearchIndexRainlabPage.php

And here is an example which index a Model:


namespace Foo\Bar\Classes;

use Trepmag\Solr\Classes\SearchIndex;
use Foo\Bar\Models\MyData;
use Solarium\Core\Query\DocumentInterface;

class SearchIndexMyData extends SearchIndex {

    public static function getObjectClass() {
        return \Foo\Bar\Models\MyData::class;

    // Set default fields values to be indexed
    protected function setDefaultFieldsValues($item) {
        $this->id = $item->dataid;
        $this->type = 'Data Source';
        $this->is_hidden = $item->datadisplay ? 1 : 0;
        $this->mtimeDate = \DateTime::createFromFormat('Y-m-d', $item->pubdate);
        $this->title = $item->title;
        $this->abstract = $item->abstract;

    // Optionally override the following method to index other fields
    public function buildDoc($item, DocumentInterface $doc) {
        parent::buildDoc($item, $doc);

        // Other fields to add to the index
        $doc->datatype_s = $item->DataType->datatype;

        return $doc;

    public function getItems() {
        $myDatas = MyData::whereNotNull('dataid')->Where('dataid', '<>', '');
        return $myDatas->get();


Then register the search index class to config/solr.php as follow:


return [
    'endpoints' => [
        'endpoint' => [
            'localhost' => [
                'host' => 'solr',
                'port' => 8983,
                'path' => '/',
                'core' => 'lando',
    'search_index_classes' => [
        \Foo\Bar\Classes\SearchIndexMyData::class, // Here...

Multiple fixes (json.facet wasn't filtering, solr update index commit at the end of the process, etc, ...) and some code enhancements

May 14, 2020


Improve facet filter behavior, querystring naming and value processing

May 02, 2020


Add jsonFacetApi parameter input and processing

Apr 28, 2020


First version of Solr

Apr 23, 2020