Drupal/C4/Solr-Search-and-Facets-Implementation/English-timed

From Script | Spoken-Tutorial
Jump to: navigation, search
Time
Narration
00:01 Welcome to the spoken tutorial on Solr Search and Facets Implementation.
00:07 In this tutorial, we will learn about-
00:09 Introduction to Solr search
00:12 Salient features of Solr search
00:15 Installation of Solr search and
00:17 Creation of Facets
00:19 To record this tutorial, I am using Ubuntu Linux 16.04
00:25 Drupal 8 and Firefox web browser
00:29 You can use any web browser as per your choice.
00:33 To practise this tutorial, you should have basic knowledge of Drupal.
00:38 If not, for relevant Drupal tutorials, please visit the link shown.
00:43 You should also have a working Internet connection.
00:47 First let us learn what is an API.
00:50 API stands for Application Programming Interface.
00:54 It has a set of rules that software programs can follow to interact with each other.
01:00 More information on API is given in the Additional reading material link of this tutorial.
01:07 What is Solr Search API?
01:10 Solr is an open source search platform used to build a Search Application.
01:16 It enables us to create custom search engines that index databases, files and websites.
01:23 Why do we need Solr Search API?
01:27 The default search that comes with Drupal does database search.
01:32 It leads to slower process and extra load on MySQL.
01:37 But Solr provides a different server for searching. It will speed up the search operation.
01:44 Some of the features of Solr are listed here.
01:47 It is scalable.
01:49 It has full text search capabilities.
01:52 It is flexible and extensible.
01:55 It has a friendly user interface.
01:58 It has fault tolerance.
02:01 Next we will learn about Solr core.
02:04 Solr core is used to perform operations like indexing and analyzing
02:10 It is a single index and associated configuration files
02:16 We can index data with different structures
02:20 A Solr server may contain one or more cores
02:23 Multiple cores are used when we need multiple versions, languages, or configurations
02:31 In this example there is one core each for Articles and Weblogs in a single Solr Server Instance.
02:39 Next let us learn the Solr implementation process step by step.
02:44 The following steps are applicable to Bitnami Drupal Stack.
02:49 But most of the steps are applicable to any other Drupal installation, as well.
02:54 Step No. 1 - Open your terminal and run the following commands to update and upgrade your machine.
03:02 Note that you should run this command as a root user.
03:06 Step No. 2 - Since Solr is based on Java, we need to have JRE or JDK installed in our system.
03:16 For this, first we need to install python software properties.
03:21 So run the following command.
03:24 Note that you should run the upcoming commands as a normal user.
03:29 Next we will run this command for setting up the JRE.
03:34 Then to update the system with the unsupported packages, type sudo space add hyphen apt space update. Press Enter.
03:47 Finally run the following command to install the latest version of oracle Java8.
03:54 Now we can check the installed Java version by typing java space hyphen version.

Press Enter.

04:03 Next we have to set-up the default Java environment variable.
04:08 So, run the following command.
04:12 Step No. 3. Next we will learn to install Solr in our local machine.
04:18 First we have to change the directory to tmp.
04:22 Now we will download the Solr version 6.6.3 from their web page.
04:28 Type the following command.
04:31 Note that you can download any latest version from their website.
04:36 Next we will extract the tar file using the following command.
04:40 Now we should install Solr as a service in our system.
04:45 So type the following command.
04:48 Then we will check the status of Solr by typing service space Solr space status

Press Enter.

04:58 We can see that the service Solr is installed in our system and activated as well.
05:03 Step No. 4

We will now create a new solr core in Solr to index our Drupal content.

05:11 Type the following command carefully.
05:14 Here I have named the newly created core as testcollection.
05:19 By default solr application listens on TCP port 8983.
05:25 So,we can access the Solr admin user interface through the port 8983.
05:31 In the URL bar, type http://localhost:8983/Solr/
05:42 In the Core Selector field, we can see the list of all the available core.
05:47 Clicking on any particular core, will give us the associated details.
05:53 That is all about Solr installation in our local system.
05:57 Step No. 5, Next we will implement the Solr search API in Drupal8.
06:04 For this, mbstring extension of PHP and composer should be installed in our machine.
06:11 The steps to install the above software are given in the Additional reading material link of this tutorial.
06:18 Once the required installation is done, change the directory to htdocs of Drupal.
06:24 After this, we need to install solarium library in Drupal8.
06:30 Solarium is a Solr client library for PHP.
06:34 Execute the following command to install it.
06:38 Next we will install search API Solr module to Drupal8 via composer.
06:44 Type the following command.
06:47 We will also download Facets module to Drupal8 to be used later on.
06:53 Type the following command. At this point, we have downloaded all the required modules.
07:01 Step No. 6 - Next go to the Drupal8 site and enable the modules that we have installed.
07:09 Go to Extend tab.
07:11 Put a check mark on the modules Facets, Search API, Solr search and Solr Search Defaults.
07:20 Click on the Install button at the bottm, to enable them.
07:24 We can see that all the four modules have been installed.
07:28 Now we have to disable the default Search module of Drupal8 named Search.
07:34 To do so, click on the Uninstall tab in the Extend page.
07:39 Put a check mark on the Search module and click on the Uninstall button at the bottom.
07:44 Again click on the Uninstall button to confirm.
07:48 Next we have to allow our Drupal to communicate with Solr.
07:53 For that, switch back to terminal and run the following command carefully.
07:58 This will copy the configuration files from modules folder of Drupal8 to the core of Solr.
08:05 After copying the configuration files, to restart the Solr service, type sudo space service space solr space restart

Press Enter.

08:17 Step No. 7

Next we will configure the Solr server and index the available content in the default search index.

08:27 To do so, go to Configuration tab.
08:30 Click on the Search API under SEARCH AND METADATA.
08:34 Right now we can see that the Solr server could not be reached.
08:38 Click on Edit of Solr Server.
08:41 Scroll down. In the Solr core field, type your core name.
08:46 I will type testcollection.
08:48 Leave the other settings as default and click on the Save button at the bottom, for saving the configuration.
08:55 Now we can see that the server connection could be reached and the core connection could be accessed.
09:01 Step No. 8

Next we will index the available content in the Solr server.

09:08 Click on the Edit button of Default Solr content index.
09:12 We can change the settings as per our requirements.
09:16 For now, I will keep them as it is and click on the Save button at the bottom.
09:21 We can see right now 0 items are indexed in the Solr server.
09:27 To index all the content, click on the Index now button at the bottom.
09:31 We can see all the 20 contents are indexed in the Solr server.
09:36 With this we have successfully enabled both the Solr server and index.
09:41 Step No. 9 . Next let us learn to search our content using the Solr search.
09:48 For that, first go to Structure, then Views.
09:52 We can see the Solr search content view here.
09:55 Click on the Edit button of Solr search content.
09:59 Note that Solr search content is a page which can be accessed on the path /Solr-search/content.
10:09 We can also see the preview of the view.
10:12 Now we will access the Solr search content page.
10:16 In the URL bar, type http://localhost:8080/drupal/solr-search/content
10:30 If you are not using Bitnami Drupal Stack, please use localhost instead of localhost:8080.
10:39 The Solr search content page appears now. In the Search field, type Drupal. Press Enter
10:47 It displays few results which are having the word “Drupal” in their content.
10:53 Step No. 10 Next we will learn to create Facets for categorizing the search results.
11:00 For doing so, go to Configuration tab. Click on the Facets under SEARCH AND METADATA.
11:07 Click on the Add facet button.
11:10 In the Facet source drop down, select the source.
11:15 In the Field drop down, we will select the Title as facet field.
11:20 In the Name field, I will type Title as a name of this Facet.
11:25 Finally click on the Save button to save the configuration.
11:29 Here you can select the widget from the available types.
11:34 I am selecting List of links for now.
11:37 Leave the remaining settings on default and click on the Save button to save the configuration.
11:44 Step No. 11

Next we will learn to place the Facet which we configured now.

11:50 For that go to Structure → Block layout.
11:54 To place the block in the Sidebar second region, click on the Place block button.
12:00 In the dialog box that appears, select the Facet named Title.
12:05 Configure the block as per your need. Click Save block button.
12:11 The Facet is added in the Sidebar second region.
12:15 Step No. 12

Next we will go back to our Solr search content page and see how Facet works.

12:23 In the Search field, type Drupal. Press Enter.
12:28 It displays few results which have the word “Drupal” in their content.
12:34 We can also see Facet displaying the titles which have Drupal as a word in their content.
12:41 This is all about the implementation of Solr search and Facets in Drupal8.
12:47 With this, we come to the end of this tutorial.
12:51 Let us summarize. In this tutorial, we have learnt to- install Solr application
12:57 Install essential modules via composer
13:00 configure Solr search API and configure Facets
13:05 The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

13:13 The Spoken Tutorial Project Team conducts workshops and gives certificates to those who pass online tests.

For more details, please write to us.

13:22 Spoken Tutorial Project is funded by NMEICT, Ministry of Human Resource Development and NVLI, Ministry of Culture Government of India.
13:33 This tutorial is contributed by Prachi Sharma.

This is Priya from IIT Bombay signing off. Thanks for joining.

Contributors and Content Editors

PoojaMoolya