Solr integration for SilverStripe. Note that this is NOT related to the silverstripe/fulltext package.
A module that extends the base functionality of the extensible search module,
adding the ability to index and search content from a Solr instance.
If you have recently been using the solr search module prior to the
extensible search upgrade, the following steps will need to be taken.
/dev/tasks/SolrSearchPageMigrationTaskto update all search page references
For demonstration and testing purposes, a standalone Jetty based
installation of solr is available in the solr/ subdirectory. To execute,
simply change to that directory and run java -jar start.jar - the default
settings will be fine for evaluation.
If you are running a custom Solr instance, make sure to copy the
solr/solr/solr/collection1/conf/schema.xml file to your solr instance -
there are a couple of custom types defined that SilverStripe uses; the XML
for these is below, if you want to place in your own schema.xml file.
<!-- SilverStripe multivalue field and sortable support --> <dynamicField name="*_ms" type="string" indexed="true" stored="true" multiValued="true"/> <dynamicField name="*_as" type="alphaOnlySort" indexed="true" stored="true"/>
If you have a configuration different to the default locahost:8983/solr
configuration, you can configure things by calling
SolrSearchService::$solr_details = array();
The following YAML will need to be added when using the extensible search page, so the solr search engine appears.
ExtensibleSearchPage: search_engine_extensions: SolrSearch: 'Solr' extensions: - 'SolrSearch' ExtensibleSearchPage_Controller: extensions: - 'SolrSearch_Controller'
Add the SolrIndexable extension to any SiteTree objects you want to search.
Support for other data objects may work, though file indexing is not yet
By default, the solr indexer will index Title and Content fields. If you want
other fields indexed too, add them to your $searchable_fields static
variable in your class type.
There is also an optional set of extensions available if you wish to enable
an additional SiteTree index based on user permissions (rather than filtering
the search result's response).
This will require the Queued Jobs module to function, due to the recursive
indexing when saving a page. https://github.com/silverstripe-australia/silverstripe-queuedjobs
Object::add_extension('SiteTree', 'SiteTreePermissionIndexExtension'); Object::add_extension('ExtensibleSearchPage', 'SolrSearchPermissionIndexExtension');
First, you need to tell the search page what you're going to be faceting on
SolrSearch::$facets = array('MetaKeywords_ms');
then make sure that field (MetaKeywords) is included in the list of fields to
index via the searchable_fields static.
*_ms represents a multivalue field.
*_as represents a sortable field (which doesn't require tokenization).
To customise search results displayed, provide a SolrSearch_results.ss
file in your theme's templates directory.
If you have ADMIN privileges, you can start and stop the locally bundled
jetty version of solr from within the CMS on the Solr admin section.
To set the java path (if different from /usr/bin/java), set
to the appropriate path
If you aren't getting any search results, first make sure Solr is running and
has been indexed.
<marcus (at) silverstripe (dot) com (dot) au>
Solr is licensed under the Apache License
This module is licensed under the BSD license
Module rating system helping users find modules that are well supported. For more on how the rating system works visit Module standards
Score not correct? Let us know there is a problem