Difference between revisions of "Drupal/C4/Solr-Search-and-Facets-Implementation/English"
(Created page with " {| style="border-spacing:0;" | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| <cent...") |
Nancyvarkey (Talk | contribs) |
||
Line 17: | Line 17: | ||
* Installation of Solr search | * Installation of Solr search | ||
* Creation of Facets | * Creation of Facets | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| In this tutorial, we will learn about- | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| In this tutorial, we will learn about- | ||
Line 25: | Line 23: | ||
* Installation of '''Solr search''' and | * Installation of '''Solr search''' and | ||
* Creation of '''Facets''' | * Creation of '''Facets''' | ||
− | |||
− | |||
|- | |- | ||
Line 38: | Line 34: | ||
* Drupal 8 | * Drupal 8 | ||
* Firefox web browser | * Firefox web browser | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| To record this tutorial, I am using | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| To record this tutorial, I am using | ||
Line 56: | Line 50: | ||
* If not, for relevant''' Drupal''' tutorials please visit [http://spoken-tutorial.org/ http://spoken-tutorial.org] | * If not, for relevant''' Drupal''' tutorials please visit [http://spoken-tutorial.org/ http://spoken-tutorial.org] | ||
* A working''' Internet connection''' | * A working''' Internet connection''' | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| To practise this tutorial, you should have basic knowledge of''' Drupal'''. | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| To practise this tutorial, you should have basic knowledge of''' Drupal'''. | ||
Line 94: | Line 86: | ||
* Open source search platform used to build '''Search Application''' | * Open source search platform used to build '''Search Application''' | ||
* Create custom search engine | * Create custom search engine | ||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| What is '''Solr Search API?''' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| What is '''Solr Search API?''' | ||
Line 101: | Line 92: | ||
* '''Solr''' is an open source '''search platform''' used to build a '''Search Application.''' | * '''Solr''' is an open source '''search platform''' used to build a '''Search Application.''' | ||
* It enables us to create custom '''search engines''' that index databases, files and websites. | * It enables us to create custom '''search engines''' that index databases, files and websites. | ||
− | |||
− | |||
|- | |- | ||
Line 113: | Line 102: | ||
* Solr provides a different server for searching | * Solr provides a different server for searching | ||
* It will speed up the '''search '''operation. | * It will speed up the '''search '''operation. | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Why do we need '''Solr Search API'''? | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Why do we need '''Solr Search API'''? | ||
Line 121: | Line 108: | ||
* It leads to slower process and extra load on '''MySQL'''. | * It leads to slower process and extra load on '''MySQL'''. | ||
* But '''Solr''' provides a different '''server''' for searching. It will speed up the '''search '''operation. | * But '''Solr''' provides a different '''server''' for searching. It will speed up the '''search '''operation. | ||
− | |||
− | |||
|- | |- | ||
Line 134: | Line 119: | ||
* Friendly user interface | * Friendly user interface | ||
* Fault tolerance | * Fault tolerance | ||
− | |||
− | |||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Some of the features of '''Solr''' are listed here. | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Some of the features of '''Solr''' are listed here. | ||
Line 157: | Line 140: | ||
* A '''Solr server''' may contain one or multiple cores | * A '''Solr server''' may contain one or multiple cores | ||
* Multiple '''cores''' are used when we need multiple versions, languages, or configurations | * Multiple '''cores''' are used when we need multiple versions, languages, or configurations | ||
− | |||
− | |||
|- | |- | ||
Line 215: | Line 196: | ||
''sudo apt-get install python-software-properties'' | ''sudo apt-get install python-software-properties'' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| For | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| For this, first we need to install '''python software properties'''. |
So run the following '''command'''. | So run the following '''command'''. | ||
+ | |||
+ | |- | ||
+ | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| | ||
+ | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Note that you should run the upcoming commands as a normal user. | ||
|- | |- | ||
Line 266: | Line 251: | ||
|- | |- | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''wget http://www-us.apache.org/dist/lucene/Solr/6.6.2/solr-6.6. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''wget http://www-us.apache.org/dist/lucene/Solr/6.6.2/solr-6.6.3.tgz'' |
Line 272: | Line 257: | ||
''www-us.apache.org/dist/lucene/solr'' | ''www-us.apache.org/dist/lucene/solr'' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Now we will download the '''Solr version 6.6. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Now we will download the '''Solr version 6.6.3''' from their web page. |
Line 286: | Line 271: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''sudo ./install_Solr_service.sh solr-6.6.2.tgz'' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''sudo ./install_Solr_service.sh solr-6.6.2.tgz'' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Now we should install '''Solr''' as a service in our system. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Now we should install '''Solr''' as a '''service''' in our system. |
Line 333: | Line 318: | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| By default solr application listens on TCP port 8983. | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| By default '''solr application''' listens on '''TCP port 8983'''. |
Line 376: | Line 361: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''cd /home/spoken/drupal-8.4.4-0/apps/drupal/htdocs'' | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Type ''cd /home/spoken/drupal-8.4.4-0/apps/drupal/htdocs'' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Once the required installation is done, change the directory to ''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Once the required installation is done, change the directory to '''htdocs''' of '''Drupal'''. |
|- | |- | ||
Line 437: | Line 422: | ||
|- | |- | ||
| style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Click '''Install''' button | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Click '''Install''' button | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Click on the '''Install''' button at the | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| Click on the '''Install''' button at the bottm, to enable them. |
Line 456: | Line 441: | ||
− | + | Again click on the '''Uninstall''' button to confirm. | |
|- | |- | ||
Line 469: | Line 454: | ||
Highlight source and destination | Highlight source and destination | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| |
− | + | ||
− | + | ||
Next we have to allow our '''Drupal''' to communicate with '''Solr'''. | Next we have to allow our '''Drupal''' to communicate with '''Solr'''. | ||
Line 485: | Line 468: | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| After copying the '''configuration files''', to restart the '''Solr | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| After copying the '''configuration files''', to restart the '''Solr service''', typing '''sudo space service space solr space restart''' |
Line 572: | Line 555: | ||
Highlight '''Index Status''' | Highlight '''Index Status''' | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| We can see | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| We can see right now 0 items are indexed in the '''Solr server'''. |
Line 578: | Line 561: | ||
− | Now we can see all the | + | Now we can see all the 20 contents are indexed in the '''Solr server'''. |
− | With this we have successfully enabled both the '''Solr server '''and''' | + | With this we have successfully enabled both the '''Solr server '''and '''index.''' |
Line 635: | Line 618: | ||
|- | |- | ||
− | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| In the search field, type''' Drupal.''' | + | | style="background-color:#ffffff;border:1pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.079cm;padding-right:0.191cm;"| In the '''search field,''' type''' Drupal.''' |
Line 750: | Line 733: | ||
− | In the '''Search''' | + | In the '''Search field''', type '''Drupal'''. |
Line 774: | Line 757: | ||
Summary | Summary | ||
− | * Install Solr application | + | * Install '''Solr''' application |
− | * Install essential modules via composer | + | * Install essential '''modules''' via '''composer''' |
− | * Configure Solr search API | + | * Configure '''Solr search API''' |
− | * Configure Facets | + | * Configure '''Facets''' |
Line 789: | Line 772: | ||
* configure '''Solr search API''' and | * configure '''Solr search API''' and | ||
* configure '''Facets''' | * configure '''Facets''' | ||
− | |||
− | |||
|- | |- |
Latest revision as of 09:46, 8 June 2018
|
|
Slide 1:
Solr Search and Facets Implementation in Drupal8 |
Welcome to the spoken tutorial on Solr Search and Facets Implementation. |
Slide 2:Learning Objectives
|
In this tutorial, we will learn about-
|
Slide 3:
System requirement To record this tutorial, I am using
|
To record this tutorial, I am using
You can use any web browser as per your choice. |
Slide 4:
Pre-requisites
|
To practise this tutorial, you should have basic knowledge of Drupal.
|
Slide 5:
API
|
First let us learn what is an API.
|
Slide 6:
What is Solr
|
What is Solr Search API?
|
Slide 7:
Solr Search API
|
Why do we need Solr Search API?
|
Slide 8:
Salient Features of Solr
|
Some of the features of Solr are listed here.
<<PAUSE>> |
Slide 9:
What is Solr core? |
Next we will learn about Solr core.
|
In this example there is one core each for Articles and Weblogs in a single Solr Server Instance. | |
Show text Solr implementation process
|
Next let us learn the Solr implementation process step by step.
|
Show text Step No. 1
sudo apt-get update && apt-get upgrade -y
|
Step No. 1
|
Show text Step No. 2
|
Step No. 2
|
Type
sudo apt-get install python-software-properties |
For this, first we need to install python software properties.
|
Note that you should run the upcoming commands as a normal user. | |
Type sudo add-apt-repository ppa:webupd8team/java | Next we will run this command for setting up the Java Runtime Environment. |
Type sudo add-apt update | Then to update the system with the unsupported packages,
type sudo space add hyphen apt space update
|
Type sudo apt install oracle-java8-installer | Finally run the following command to install the latest version of oracle Java8. |
Type java -version | Now we can check the installed Java version by typing java space hyphen version.
|
Type sudo apt install oracle-java8-set-default | Next we have to set-up the default Java environment variable.
|
Show text Step No. 3 | Step No. 3
|
Type cd /tmp | First we have to change the directory to /tmp. |
Type wget http://www-us.apache.org/dist/lucene/Solr/6.6.2/solr-6.6.3.tgz
www-us.apache.org/dist/lucene/solr |
Now we will download the Solr version 6.6.3 from their web page.
|
Type tar xzf solr-6.6.2.tgz solr-6.6.2/bin/install_solr_service.sh --strip-components=2 | Next we will extract the downloaded tar file using the following command. |
Type sudo ./install_Solr_service.sh solr-6.6.2.tgz | Now we should install Solr as a service in our system.
|
Type service Solr status
|
Then we will check the status of Solr by typing
service space Solr space status
|
Show text Step No. 4
|
Step No. 4
|
Type in the URL bar - http://localhost:8983/Solr/
|
By default solr application listens on TCP port 8983.
|
Click Core Selector field | In the Core Selector field, we can see the list of all the available core. |
Click the core testcollection | Clicking on any particular core, will give us the associated details.
|
Show text Step No. 5
|
Step No. 5
|
Type cd /home/spoken/drupal-8.4.4-0/apps/drupal/htdocs | Once the required installation is done, change the directory to htdocs of Drupal. |
Type composer config repositories.drupal composer https://packagist.org
|
After this, we need to install solarium library in Drupal8.
|
Type composer require “drupal/search_API_solr”
|
Next we will install search API Solr module to Drupal8 via composer.
|
Type composer require “drupal/facets:^1.0”
|
We will also download Facets module to Drupal8 to be used later on.
|
Show text Step No. 6
|
Step No. 6
|
Click Extend tab | Go to Extend tab. |
Click Facets, Search API, Solr search, Solr Search Defaults | Put a check mark on the modules Facets, Search API, Solr search and Solr Search Defaults. |
Click Install button | Click on the Install button at the bottm, to enable them.
|
Click Uninstall tab | Now we have to disable the default Search module of Drupal8 named Search.
|
Click Search
Click Uninstall button |
Put a check mark on the Search module and click on the Uninstall button at the bottom.
|
Show text Step No. 6
|
Next we have to allow our Drupal to communicate with Solr.
|
Type sudo service solr restart
|
After copying the configuration files, to restart the Solr service, typing sudo space service space solr space restart
|
Show text Step No. 7
|
Step No. 7
Next we will configure the Solr server and index the available content in the default search index.
|
Highlight Solr server could not be reached
|
Right now we can see that the Solr server could not be reached.
|
Scroll down
|
Scroll down.
|
Click Save
|
Leave the other settings as default and click on the Save button at the bottom, for saving the configuration.
|
Show text Step No. 8
|
Step No. 8
|
Click Save | We can change the settings as per our requirements.
|
Highlight Index Status
|
We can see right now 0 items are indexed in the Solr server.
|
Show text Step No. 9
|
Step No. 9
|
Click Edit
|
Click on the Edit button of Solr search content.
|
In the URL, type http://localhost:8080/drupal/solr-search/content
|
Next we will access the Solr search content page.
|
In the search field, type Drupal.
|
The Solr search content page appears now.
|
Show text Step No. 10
|
Step No. 10
|
Click Add facet | Click on the Add facet button. |
In Facet source, select source | In the Facet source drop down, select the source. |
In Field, select Title | In the Field drop down, we will select the Title as facet field. |
In Name, type Title | In the Name field, I will type Title as a name of this Facet. |
Click Save | Finally click on the Save button to save the configuration. |
Select List of links
|
Here you can select the widget from the available types.
|
Show text Step No. 11
|
Step No. 11
|
In the Sidebar second, click Place block | To place the block in the Sidebar second region, click on the Place block button. |
Select Filter by Title facets.
|
In the dialog box that appears, select the Facet named Title.
|
Click Save blocks button | Now click Save blocks button at the bottom. |
Show text Step No. 12
|
Step No. 12
|
Point the Facets | We can also see Facet displaying the titles which have Drupal as a word in their content. |
This is all about the implementation of Solr search and Facets in Drupal8.
| |
Slide 10:
Summary
|
Let us summarize.
|
Slide 11:
Acknowledgement
|
The video at the following link summarises the Spoken Tutorial project.
|
Slide 12:
Spoken Tutorial Workshops
|
The Spoken Tutorial Project Team conducts workshops and gives certificates to those who pass online tests.
|
Slide 13:
Acknowledgement
|
Spoken Tutorial Project is funded by
Government of India. |
This tutorial is contributed by Prachi Sharma.
|