dev-master
9999999-devBasic implementation of a FulltextSeach index and search form in SilverStripe
The Requires
search silverstripe fulltext solr
Basic implementation of a FulltextSeach index and search form in SilverStripe
Extends the FullTextSearch module with a default configuration that provides a basic Solr configuration and search results page., (*1)
Since the FullTextSearch module is a work in progress and subject to change, this module should be considered alpha. In the near future, the FulltextSearch module may also provide this functionality out of the box., (*2)
To start using Solr, install this module along with the fulltextsearch module and run dev/build. After running the database rebuild, start the Solr server up., (*3)
The fulltextsearch module provides a basic server suitable for testing. To start that run:, (*4)
cd fulltextsearch/thirdparty/solr/server/ && java -jar start.jar &
If Solr has started up and is running, we should first make sure the data
directory exists (default: /data/solr) or configured by the SOLR_BASE_PATH
value in your _ss_environment.php
file., (*5)
mkdir /data/solr
Ensure that your web server can write to that folder. Then to populate that directory run the configure task:, (*6)
sake dev/tasks/Solr_Configure
That will populate the /data/solr/FulltextSearchDefaultIndex/conf
directory
with the configuration files such as schema.xml
and solrconfig.xml
. More
information about these files can be found in the Solr Manual, (*7)
For more information about the SilverStripe wrapper around Solr consult the fulltextsearch module directly., (*8)
This module will provide a new page type in the CMS called FulltextSearchDefaultPage
along with a default index. More about customizing the index is below., (*9)
Both the page type and the index are designed to be starting points for developers to use to extend to make the most of their Solr service., (*10)
To index your own dataobjects, subclass the FulltextSearchDefaultIndex
class
and add your own types in., (*11)
:::php <?php class CustomFulltextSearchIndex extends FulltextSearchDefaultIndex { public function init() { parent::init(); // adds a new dataobject to the search $this->addClass('MyDataObjectProduct'); // define a new field to search $this->addFulltextField('ProductDescription', 'HTMLText') } }
Tell the FulltextSearchDefaultPage
that you want to use your new index by
using the Config
api., (*12)
:::yml FulltextSearchDefaultPage: index_class: CustomFulltextSearchIndex
Basic implementation of a FulltextSeach index and search form in SilverStripe
search silverstripe fulltext solr