Skip to main content

Posts

SOLID Principles in Software Development

  The SOLID principle was introduced by Robert C. Martin, also known as Uncle Bob and it is a coding standard in programming. This principle is an acronym of the five principles which is given below- Single Responsibility Principle (SRP) Open/Closed Principle Liskov’s Substitution Principle (LSP) Interface Segregation Principle (ISP) Dependency Inversion Principle (DIP) Single Responsibility Principle:  A class should have only one reason to change This  means every class should have a single responsibility or purpose. The class shall be updated only when a the behavior for this single responsibility changes. For E.g. If a class is responsible for login logic, then that is all it should do. Any other similar functionalities like Registration or Change Password should be implemented separately. As such, only when a change is required in Login logic will cause the class to be updated. If we keep updating a class for adding features which are not related to a single purpose, it makes the

Solr Search for Sitecore - Notes --Draft

SOLR SEARCH QUICK NOTES http://www.solrtutorial.com/solr-query-syntax.html BASIC CONCEPTS Solr prepares indexes. Indexes contains documents and documents contains fields. Documents can be assumed as rows in a table and fields as columns in tables. Before adding documents to index, we need to specify the schema. (not advisable to change schema after documents have been added).  The schema declares - what kinds of fields there are which field should be used as primary key which fields are required how to index and search each field When we search for a word, the word undergoes transformation to get converted to a token. SOLR then looks for these tokens in its indexes. Each token contains references to pages where it was found when SOLR was crawling and this is how search results are returned. All fields are not searchable. Many of them are maintained in indexes so that when a match is found, the field values may need to be displayed in the search results. This is done by following settin

Script to renew self-singed certificates in Sitecore

This one is an article to spread awareness about script solutions available in community but not popular.  As my self-signed certificates for Sitecore 10.0 instance expired, I want to use SIF or CLI to renew them and best also to replace thumbprints to minimize manual work. Is this possible with SIF or CLI? Or is there any ps1 script I could use. We have a LOT of test environments. As the certs have been expiring, I was complaining about the manual process I was using to change/update these. My clever co-worker Karl bowled up a powershell script that has been such a help!  This will generate a new CA cert for you to base all your self-signed certs on, or it will use one you already have. Put the pfx file in the same directory as the script. It displays all the sites in IIS and you pick the one to update - say a Sitecore 9 xconnect site, changes out the cert in the bindings, updates the thumbnails where needed in config. So easy once you've used it a couple of times. Enjoy. https://

Solr Search facet values limited to 100 only in Sitecore SXA

The Problem Recently, a Sitecore developer reported an issue where he could not get more than 100 values for a facet field in SXA search component. He tried updating Query.MaxItems and also  XA.Foundation.Search.QueryMaxItems but still did not get more that 100 values for the facet field. The Research I started looking into this out of curiosity. I checked Sitecore configs and did not find any other setting which could be affecting it. I realized soon that this was most likely something limited on SOLR side. On researching, I found out that indeed this is related to SOLR default settings. Below is the snapshot from documentation about it and more info can be found here -  The Solution So, on your SOLR Server, edit the solrconfig.xml for the index you are using. It is found in the conf folder of your index. Find the requesthandler you are using, for e.g. "/select", and add <str name="facet.limit">-1</str> as in snapshot below -       Repeat this for ea

What Sitecore MVP Kickoff webinar feels like!

Recently, I had the honor of being awarded the Sitecore MVP award for Technology in 2023. I wrote about my experience here  and promised that I will keep sharing about my learnings from the program. So, here are some insights from Sitecore MVP Kickoff webinar. The webinar basically outlines what MVP program is about. There were presentations about the roadmap for Sitecore in 2023, little bit description about different tools Sitecore is comprised of now and then some presentations from community expert Tamas Varga, Peter Brinkmann etc. where they talked about MVP program and how they can help MVPs with works related to Sitecore. Some key interesting points I learnt and that I can share with you guys are below -  What do people do to become eligible for MVP award? Below is the list of contributions that Sitecore MVPs usually make over the year- What are the benefits of being a Sitecore MVP? One of the main questions that got answered was what are the benefits of being a Sitecore MVP and

Make Sitecore instance faster using Roslyn Compiler

When we install the Sitecore instance on local, the first load is slow. After each code deploy also, it takes a while for the Sitecore instance to load and experience editor to come up. For us, the load time for Sitecore instance on local machines was around 4 minutes. We started looking for ways to minimize it and found that if we update our Web.config to use Roslyn compiler and include the relevant Nugets into the project, our load times will improve. We followed the simple steps - Go to the Project you wish to add the NuGet package and right click the project and click 'Manage NuGet Packages'. Make sure your 'Package Source' is set to nuget.org and go to the 'Browse' Tab and search Microsoft.CodeDom.Providers.DotNetCompilerPlatform. Install whichever version you desire, make sure you note which version you installed. You can learn more about it  here . After installation, deploy your project, make sure the Microsoft.CodeDom.Providers.DotNetCompilerPlatform.d

Error while writing serialized item - Serialized version contained a blank language value - Sitecore Serialization error in CLI

Sitecore Content Serialization (SCS) is a system for serializing, sharing, and deploying content items, as well as keeping them in version control. It combines best of both Unicorn and TDS tools used widely in Sitecore applications for content serialization. If you havent used it yet, you should give it a try and learn more from  here . The Problem Recently, while performing a dotnet sitecore ser pull command to get latest updates of an item into source control, I got the below errors -  System.InvalidOperationException: Error while writing serialized item C:\projects\MyProbject.Website\src\Project\MyProjct\code\module\serialization\MySite\Home.yml ---> System.InvalidOperationException: Serialized version contained a blank language value! So this looked familiar with invariant language issue where an item may have field values in a language that doesn't exist or to put simply no language or blank language. This makes the item an invalid item and hence, it fails the serializati