Thursday, April 28, 2022

Solr Computed Index Field & Rebuild Index using Sitecore CLI

                                    


In this blog, we can look into Sitecore search with the Solr computed index field. A computed index field is processed for every Sitecore item that gets indexed. 

Use case:


            Consider an example of a food product that has different search criteria based on category, ingredients and allergy content, etc,. 



How can do it simpler using Sitecore-Solr?  

Computed Index Field


Sitecore Items


               I have attached the template structure of the Product and search criteria from Sitecore.

Template Structure

          

Item Structure

                  This is how the items look like with the search criteria


SOLR Index Field

                Our Computed Index field should look like this as highlighted below






How do achieve it? 


Solr Configuration

          Create the Solr computed Index field as below with the appropriate return type in my case it is string collection.
 

Computed Index Field

           Combining those field values into a single computed field.


API Output

                 My simple API look like :)

URL: https://samplecm.dev.local/api/sitecore/productbycategory/GetProducts?queryText=gluten

 


URL: https://samplecm.dev.local/api/sitecore/productbycategory/GetProducts?queryText=wheat

                              
                                        


 Complete Code Repo available here =>

https://github.com/SriramGayathri/SitecoreComputedIndexFieldExample

Tips:

    If the computed index field does not appear in SOLR, we have got a cool feature in Sitecore CLI - Index Manager

  • Populate solr schema
  • Rebuild Index  



More details on the Sitecore CLI commands can be found on the Sitecore docs =>


                                            Happy Sitecore Learning!!!

Tuesday, April 19, 2022

Content Author - Bulk Rendering Update based on Template standard value Using Sitecore PowerShell


              In this blog, I would like to discuss another Sitecore PowerShell module that helps bulk rendering change based on the page Template standard values.

Scenario

            We have a page Template and based on that there would be 100+ content pages. Page item should get updated when there is a change done on Page Template standard value rendering. Usually, a newly created item can incorporate this change but at times existing items do not seem to be reflecting for already existing page Items.

Pictorial Representation


Sitecore Item - Before running the script

1. Sample Item - Standard value and Home Item have the same rendering in SharedLayout

     
 

Sitecore Item - After running the script

1. Sample Item - Standard value
 
   



2. Bulk Rendering Update - Standard Value

               Choose the template which has been updated from the droptree


3. Once the item has been processed

                     


4. Home Page Item

    


Sitecore Powershell Code

    Changes have been uploaded to the Git repository. - SriramGayathri-GIT

    
                                                        Happy Sitecore Learning!!!