Skip to main content

Apache Solar Search

Apache Solr : -  Apache solr is a fast open-source Java search server.
Solr makes it easy to run a full-featured search server
Recent version -- Solr 8.11.1
default port: 8983
You can access your Solr admin panel by typing localhost:8983 in your browser.

Basic Solr Concepts:- Solr is able to achieve fast search responses because, instead of searching the text directly, it searches an index instead.


Solr is powered by Lucene, a powerful open-source full-text search library,


Limitation of default drupal Search:- 
1- default drupal search is for smaller sites only,
2- does’t deal with large content like 10k+, 
3- Limited operated
4- SQL is not designed as a searching language,
5- It runs and searches directly on the same databases,
6- RDBMS , is incapable to search well,


Benefits of using apache solr:- 
1- index and make searchable really a large amount of data from 10k up to millions,
2- Provide faceted search-based navigation like filter data based on author, date, tags, content type etc…
3-Provide Search autocomplete, Spelling suggestions, and content recommendation,
4- Provide fast search experience,
5- Expose all attributes of the node to search,
6- Place search function on a completely separate server,

Install the solr on the server,

Steps to Configure the Solr & Drupal :

Step1- Installed the apache solr if using own server (ignore if using any third part server like acquia search)
Step2- Install Search API Solr module in Drupal 8
Step3 - Configure Apache Solr with the Drupal Search API Solr Module
- Create a core in Apache Solr
- create a Solr server and index in your Drupal website
          - create a Search API index
          - Also add field for indexing
Step4- Download the config.zip file from the search API UI, and extract & move these files to solr config folder.
Step5- Index the data, It will store the data in the solr
Commands to execute the solr


 $ sudo service solr stop  
 $ sudo service solr start  
 $ sudo service solr status  

Some Drupal Modules To work with Solr:
drupal/search_api_solr
apachesolr_entity_jit_index:When create/update entity at that time it index it on the solr.
Apache Solr Views : It provides the views plugins and handlers needed to be able to create a view that fetches its results from Apachesolr index, without hitting the database.

Faceted search with Solr in Drupal 8:

Facet is a module, in Drupal 8, that provides a facility to arrange all the search results as per the category. Basically, it is an arrangement of search results based on categories, content type on indexed terms and content type.

Faceted search provides the search like Amazon, Flipkart and so on as per the category, types and all.
There are various reasons a Facet can be used:
  • It provides a drill-down search facility.
  • It can be used with default search and Solr as well.
  • It shows a number of item count for each category.
  • Facet provides a wide range of configurable setting in UI and so on.
Solr supports a range of Faceting:
1. Field faceting - Retrieve the counts for all terms or just the top terms in any given field. The field must be indexed.
2. Range faceting – It can be used on any date field or numeric field that supports range queries. There are some parameters for range Faceting. 
3. Interval faceting - It allows users to set variable intervals and count the number of documents that have values within those intervals in the specified field.
4. Query faceting - This faceting returns a number of documents in the current search results that also match the given facet query.
5. Pivot faceting - It allows to break down the values by category and sub-categories.

Part 2  

Comments

Popular posts from this blog

Get The field values of node in Drupal 8

use Drupal \ node \ NodeInterface ; /** * Implements hook_ENTITY_TYPE_insert() for node entities. * * This tests saving a node on node insert. * * @see \Drupal\node\Tests\NodeSaveTest::testNodeSaveOnInsert() */ function node_test_node_insert ( NodeInterface $node ) { // Set the node title to the node ID and save. if ( $node - > getTitle ( ) == 'new' ) { $node - > setTitle ( 'Node ' . $node - > id ( ) ) ; $node - > setNewRevision ( FALSE ) ; $node - > save ( ) ; } } Now There is so many functions are there to get the values, For All the functions available visit the API code, https://api.drupal.org/api/drupal/core%21modules%21node%21src%21NodeInterface.php/interface/NodeInterface/8.2.x Some of as below, Node edit form, Drupal 8 Automatically Load the whole object no need to load the entity like below, if ($event->getFormId() == 'node_alexa_audio_clips_edit_form') { $node = \Drupal::ro...

Drupal Setup with docker

Option 1:  docker pull mysql docker pull phpmyadmin docker pull drupal docker run -d --name MysqlClient -e MYSQL_ROOT_PASSWORD=drupal mysql Download the phpmyadmin image and Setup Container: docker run --name phpmyadmin -d --link MysqlClient:db -p 8083:80 phpmyadmin Download the Drupal image and Setup Container: docker run -d --name dweb2 --link MysqlClient -p 8082:80 -e MYSQL_USER:root -e MYSQL_PASSWORD:drupal drupal   We are using docker4 drupal and following below URL https://wodby.com/docs/1.0/stacks/drupal/local/ From Mount my codebase Download and unpack docker4drupal.tar.gz with hidden files in a new directory, also get the drupal code with in web directory composer create - project drupal / recommended - project my_site_name_dir It means with in new directory we have docker files and drupal files also has web folder for drupal. now run docker-compose up -d Now PROJECT_BASE_URL is mentioned in .env file open this url in the web with port, it will open the drupal page, ...