Assuming you have already created a SearchStax account and do not already have a deployment set up, click on the Deployments tab and then click on the Add Deployment button at the top. Enter a Deployment name, and select the most appropriate Region, Plan, and Solr Version for your needs. In the example below, we will be using Solr Version 6.4.2.
Once you create your Deployment, you will see it in the Deployments dashboard.
Clicking on the arrow button on the right of the deployment will give you pertinent information about your deployment’s servers. The Solr Load Balancer URL will bring you to your Solr server dashboard.
Download the Search API Solr plugin files: https://www.drupal.org/project/search_api_solr
Included in the Search API Solr download are several configurations in the solr-conf folder, with subfolders 4.x, 5.x, and 6.x for the respective Solr versions.
SearchStax uses Apache ZooKeeper for maintaining configuration information. Upload the appropriate configuration files via Zookeeper and create a new collection. If you have your Zookeeper script already, the two commands you will need are as follows:
zkcli.sh -zkhost <zookeeper URL> -cmd upconfig -confdir <Solr configuration> -confname <configuration name>
zkcli.bat -zkhost <zookeeper URL> -cmd upconfig -confdir <Solr configuration> -confname <configuration name>
Create New Collection:
curl ‘<Load Balancer URL>admin/collections?action=CREATE&name=<collectionName>&collection.configName=<configName>&numShards=1’
curl.exe “<Load Balancer URL>admin/collections?action=CREATE&name=<collectionName>&collection.configName=<configName>&numShards=1” -k
Detailed instructions on uploading a new configuration and creating a new collection for a Solr deployment can be found here: https://www.searchstax.com/docs/
Once complete, go into your Solr dashboard. There will be a newly created core based on the name of the collection name you defined when uploading the configuration. Make note of this core name.
If you do not already have one, there are many ways to create your own Drupal instance. Some web hosting services offer specialized integrations and setup options that help streamline the process. Here we used GoDaddy’s Cloud Server services, which in a few clicks can create a hosted Drupal website.
Go to your Drupal website and log in.
Open up a new tab in your web browser, then go to: https://www.drupal.org/project/search_api. Once there, scroll down to find the different download links. Right click on the appropriate Download link to the compressed file, and copy the link address.
In your Drupal site, either navigate to the /admin/modules page or click the Extend tab at the top. Then click Install New Module.
Paste the link address copied earlier into the “Install from a URL” text field, and then click the Install button.
Once complete, you should see a confirmation message saying that the installation was complete.
If you see this, then you can install the Solr plugin for Search API:
https://www.drupal.org/project/search_api_solr. Install this in the same way as above.
Before continuing, you may need to install the Search API Solr composer dependencies. See https://www.drupal.org/documentation/install/composer-dependencies for instructions on how to do this.
Next, you will need to enable the installed modules. Click “Enable newly added modules”, or click on the Extend tab. Scroll down to the section called Search to see new module settings.
Enable the following items: Search API, Solr search, and Solr Search Defaults.
Then click Install at the bottom of the page. You should see this confirmation:
Once complete, it is recommended to uninstall the Solr Search Defaults module, as it may affect performance. Uninstalling the module will not remove the provided configurations.
Now that the modules have been enabled, click on the Configuration tab. Look for section “SEARCH AND METADATA” and click on Search API to configure it.
Once there, click Add Server.
Give your server a name, make sure the Backend is set to Solr, and configure your Solr Backend. Check that HTTP protocol is set to https, the Solr host and Solr port are correct, and you set the Solr core that was created after uploading your Solr configuration.
If your configuration settings are valid, you will see a message saying that the information was saved successfully.
Next you will need to define an Index. In the Search API configuration screen, click on Add Index.
Give your index a name, and select the Data sources you wish to index. For this example, select Comment and Content. Also, at the bottom of the page make sure that you select the Server created earlier.
Install the Devel plugin using the same method as described in Step 4: https://www.drupal.org/project/devel. Then, enable Devel and Devel generate.
You will see new options in multiple menus. Go to Manage > Configuration, and scroll down to the Development section. Here you have options to Generate content via Devel.
Click on Generate Content.
Select a Content Type and enter the number of nodes. For example, selecting Article and typing “20” nodes will produce 20 new articles filled with dummy data.
A cron job will periodically index your site automatically, but if you want to see your results immediately go to the Search API configuration screen and click on the index created earlier. At the bottom, click on the Index now button.
After you begin, you will see a progress bar. Once it reaches 100%, you will get a Success message.
After your site has been indexed, you can view and query the data in Solr.
Congratulations! You have now customized your Drupal website to allow for content to be indexed in your SearchStax Solr deployment.
Subscribe to our monthly newsletter below and never miss the latest Cassandra and data engineering news!