Introduction:- Solr in Hybris is used to Store the data in Indexed or meaningful or arranged way, in solr data stores in the form of json so searching makes easy. It helps to make the searching faster and efficient so that our application can reduce it's time, because it holds the arranged or indexed data so while searching the products it helps to reduce the CPU time..
--> In this blog post we are going to learn about solr indexing and ValueResolver/Provider.
Here Some Importent Questions are given,which are listed below:-
Q1) Why we are using Provider/Resolver?
ans:- We are fetching data from Hybris Database and inserting it to the Solr, if we want to do some modification on data in between fetching from Hybris Database and inserting into solr. So for this we are using Provider/Resolver Otherwise there is no need of using it.
Q2 When to use Provider and when to use Resolver?
ans:- ValueProveder is now depricated from Hybris version 5.5 onwards, so it is recommanded to create own class and extend AbstractValueResolver class and and Override addFieldValues() method.
For index or arrange the data in solr, we have to do indexing of the product.
In Solr three types of Indexing are there which are listed below:
(I) Full Indexing
(I) Full Indexing :- In this strategy of indexing firstly it deletes all the Indexed documents and after that it will do freshly indexing from the scratch. In Full Indexing 2 modes are there....
Direct Mode :- While using this mode of Full Indexing if error occurs and indexing fails than lastly committed data will be available.
Two Phase Mode :- While using this mode of Full Indexing if error occurs and indexing fails than data will be rolled back to it's initial stage.
(II) Update Indexing :- In this strategy of indexing only new or modified documents will come under indexing.. It consumes less time compare than Full Indexing.
(III) Delete Indexing :- In this strategy of indexing it used to remove indexed data.....It is used to maintain the consistency of indexed data as we might have Unwanted Indexed Data in solr from a long time.
Indexing can be done in two ways
(I) Trough impex (Best Way)
(II) Through HAC
So in this post we are going to learn Indexing through impex
Below is given one example's steps to use a Resolver,
Requirement:- Display the Unit of products with it. for example if user is searching the cup than it should be displays with it's unit that is dozen similerly if user is searching t-shirt so i should be display with it's unit that is piece..
in the above product unit of the product is not displaying, now will follow some of the steps to display unit of product
Step - 1 :- create a class in com.nt.core.search.solrfacetsearch.provider.impl Package and extend AbstractValueResolver class and write here modification logic.