Posts

Showing posts from January, 2023

Creating Sitecore Index Part - 3

Image
   Introduction: In this post we will try to index Complex Fields like DropLink, DropList and so on. In this Part we will only look at DropLink. The process will remain almost the same From Sitecore Configuration perspective. Only change you might come across is Business logic in Asp.Net MVC. Since these field have reference to another Item (and not simple type) and sometimes create different objects, we cannot add them as Simple Field. We will be creating Computed field for them. Description: As per part-2, we have now successfully added simple fields. let us see how to add Complex field like Droplink. The Idea here is, to create a business logic that simplify the Output value. Droplink holds GUID of the Item that is been selected. We will try to fetch the Item thats is selected in DropLink, then pull the values as JSON to be indexed. Background: We will add Droplink to existing Template (News). fig.1 fig.2   We will add the newly create Field to be part of indexing. let...

Creating Sitecore Index Part - 2

Image
   Introduction: In Part-1 we have only created the Index that is in sync with SOLR. In this part we will try to Index only field we want to Index. Background: Let us see what we have in our Sitecore tree that will be default indexed after our Part-1 Finished. In our Custom index configuration we have given the path to be indexed as news. fig.1 fig.2 As we can see from the image above there will be 6 Items indexed (including News item). let us check our Solr for the same. fig.3 the sample from solr contains information about "Hamirpur news" (check fig.2) ,  1 - Add a Field: In practical scenario, we will not require all the fields to be indexed, thus, we will try to add selected fields only. For our scenario we will try to add "Abstract information" field only. fig.4 we need the "Abstract Information" field Id as shown in the above screen short. We will update the config file of part-1 to only Index the above mentioned Field ID. fig.5 under configuration t...

Creating Sitecore Index - part 1

Image
   Introduction: In this post we will see how we can create Sitcore solr index. Overall just to create index is simple and smooth process. All we need to do is add Folder in SOLR, add Core Index into SOLR, add custom index file into the Content Search folder (Ideally in Include Folder). Restart your app pool for the Sitecore instance. then go to control panel of sitecore. under indexing section select populate Solr managed schema followed by Indexing manager rebuilding the newly created Index. Let us see how it can be done with an example. 1- Create SOLR Custom Folder: Create Folder in Solr As Shown Below. Ideally, Copy the existing Folder and Delete all the redundant Data. As shown below. fig.1 the copied folder will have folders as shown below. fig.2 Delete "core.properties", Delete everything within data folder. 2- Add Index mapping In SOLR: Go to Solr Url. Usually it is https:// DomainName:8983/solr/# In my case since I had installed solr in 8984 port my Url is bit differ...

Sitecore Glass Mapper Editable fields.

Image
   Introduction: In our previous post we had seen how we can make  make Fields Editable in Experience Editor using " @Html.Sitecore().Fields ". But usually as the project Grows in Size we tend to use some ORM to help us get mapping task out of the box. Thus, in the section we will be Discussing how we can make the Fields Editable in Experience Editor while using Glass mapper. Implementation: We will continue to update our previous Application. The application already contains a Controller Rendering, that will be using Sitecore Helpers to make field Editable. Again as I said in previous blog, the change is right from Architecture point. Depending on how we want to target the View (Sitecore, Glass Mapper, or plain) will decide how to write the Model, Business logic, Data Fetching logic to showing view. Thus, here we will not manipulate the existing logic. We will create another Controller Rendering that will be using Glass mapper to make fields Editable in Experience Editor...

Sitecore Item tree Removal

Image
   Introduction: I was working on Sitecore 10, trying to create JSS Tenant. After couple of R&D, I had created lot of JSS Tenants. Thus, I decided to Delete All of them to give a new start.  Thus, I Right clicked on the JSS Tenant and went to scripts, Remove Tenant. However, it took around 10 minutes and still it was not deleted completely. The Script gave an error and stop with incomplete removal. I gave this try 3 to 4 times and later thought to take other way to get it done. I Created a Store Procedure to delete the Item Tree. I only takes 3 to 4 seconds to get the job done. Steps Followed: 1 - Create the given below stored procedure: (NOTE:  USE [SC10_Master]  you will have to change this based on your  master  Database Schema Name.) (SelectTreeFromRootId) ------------------------------------------------------------------------------------------------ USE [SC10_Master] GO /****** Object:  StoredProcedure [dbo].[SELECTTreeFromRootId]...