Monday, November 8, 2021

Sitecore 8.1 - update configuration from multilingual to English only and handle en in the URL redirect rule

Recently, I got a request to fix an urgent issue, the alias was not working for a Sitecore instance 8.1,  I investigated this issue and found the language context got changed from en to the alias name.

How did we identify?

on the page source code, we keep the language code and while using the alias the language context got changed. I tried a lot to find the root cause that why Sitecore is changing the language to a wired language code from the alias and found that this was a known issue in Sitecore

Reference - https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0659458


so the issue was when a letter combination that matches any of the .NET Culture Codes is in that position, it gets resolved as a language (even if the language is not registered for Sitecore XP instance) and is not used to resolve anything else (for example, an alias or an item). If a resolved language is not identified, an error similar to the following appears:

I applied the first patch to Languages.AlwaysStripLanguage to false, it worked for me but the problem was there were a few existing URLs with EN, and those started giving 404 errors.

Now, I need to keep all those URLs live,  the easiest solution was the redirect rule.

I got some good references from this link https://community.sitecore.com/community?id=community_question&sys_id=5144e3691b0770d0b8954371b24bcb9d

and finally added the below configuration on the web. config and that way we have resolved the issue.


<rewrite>

  <rules>

<rule name="English Redirect" stopProcessing="true">

<match url="^en/(.*)$" />

<action type="Redirect" url="/{R:1}" />

</rule>

  </rules>

</rewrite>

  </system.webServer>


Wednesday, October 20, 2021

Sitecore sorting best practices and recommendation.

Sometimes applying a simple sorting based on title can create an issue, we need to be very careful about it.

Applying sorting based on title is not going to work, strange right?

Let's see this in detail.

The title is a text general field and the tokenizer will make tokens of the value so logically you can't do sorting on this field


In case if we want to do the sorting on the title field, It's recommended to create a copy field which will basically copy the data from the title and move into the target field and make sure that the target field is a string field so it will hold the string value and sorting can be done.

Example for the text or text general field 




With string field



Solution - How to add a copy field  - Reference - https://solr.apache.org/guide/6_6/copying-fields.html


<copyField source="cat" dest="text" maxChars="30000" />


Hope this will help to others.

Docker issue when you got an existing machine which configured for a diff account

 Recently, I got a chance to work on an important project as a firefighter for 4 weeks, I got the existing machine and my first issue was related to the docker, here is my learning and details for the fix.

Error -' You are not allowed to use Docker, you must be in the "docker-users" group


I got this error while running the docker, to fix this issue I follow this link 

basically, we need to add the user to the docker-user membership 


Now, after doing that, I got a diff error, which is as below


to fix that, please make sure you do the sign-out, the restart and disconnect option will not work.



I hope that will help others.

Wednesday, October 13, 2021

SXA Custom Token - Best practices to include the operation correctly.

 When implementing SXA custom token, it would be good to consider the options like must, should or not, this is already part of the SXA model, so basically we need to make sure to include the below conditions.

Pass the model operation name as a parameter -


 public override void Process(ResolveSearchQueryTokensEventArgs args)

        {

            if (args.ContextItem == null)

                return;

            for (int index = 0; index < args.Models.Count; ++index)

            {

                SearchStringModel model = args.Models[index];

                if (model.Type.Equals("sxa") && this.ContainsToken(model))

                {

                    string str = model.Value.Replace(this.TokenPart, string.Empty).TrimStart('|');

                    var fieldNames = str.Split('|').ToList();

                    if (fieldNames.Any() && fieldNames.Count == 2)

                    {

                        args.Models.Insert(index, this.BuildModel(fieldNames[0], fieldNames[1], model.Operation));

                        args.Models.Remove(model);

                    }

                }

            }

        }


  protected virtual SearchStringModel BuildModel(

            string replace,

            string fieldValue, string operation)

        {

            return new SearchStringModel("custom", FormattableString.Invariant(FormattableStringFactory.Create("{0}|{1}", replace.ToLowerInvariant(), fieldValue)))

            {

                Operation = operation

            };

        }

Model operation values - Just for the reference.



SXA boosting rule - Search Box Query

 As we know that Sitecore has provided a lot of rule-based boosting options, I found the below rule very useful in a recent implementation.





We can see the appropriate logs to see that boosting is applied correctly.

2021-10-13 22:34:12.460 INFO  (qtp23211803-22) [c:sitecore_sxa_dev_master_index s:shard1 r:core_node2 x:sitecore_sxa_dev_master_index_shard1_replica_n1] o.a.s.c.S.Request [sitecore_sxa_dev_master_index_shard1_replica_n1]  webapp=/solr path=/select params={q=((((((_template:(c03a48a03baf4ba09f10774f365841a4)+OR+_template:(911e99589fa64e85901eac0e0fc96009))+AND+((_path:(0513592509aa40188c47987bc6f9236a)+AND+searchable_b:(True))+OR+(_path:(e86fa7d2714741548e25c0bcdb9217fb)+AND+searchable_b:(True))+OR+(_path:(225d1bc67544492d8d752fdaa1a7151c)+AND+searchable_b:(True))+OR+(_path:(9377586f8345460b8dd01e24a451aeb6)+AND+searchable_b:(True))))+AND+sxacontent_txm:(lifestyle~0.5))+AND+_latestversion:(True))+AND+((content_t:(*lifestyle*))^5+OR+(-_name:("")++_name:[*+TO+*])))+AND+((title_t:(*lifestyle*))^5+OR+(-_name:("")++_name:[*+TO+*])))+AND+_val_:__boost&start=0&fq=_indexname:(sitecore_sxa_dev_master_index)&sort=title_t+asc&rows=5&wt=xml&version=2.2} hits=3 status=0 QTime=17






Wednesday, September 15, 2021

Move Docker data to a different drive to save space from the c drive - Quick configuration.


Recently, while working on a project I found the space issue in C Drive and because of that, the docker container was getting shut down automatically.



Although the VM has good space in the d drive, I did the path change in the configuration and it basically saved my work.

How to make that change - We can directly do it from the docker UI settings option or can change the C:\ProgramData\Docker\config\daemon.json


Reference - https://github.com/docker/for-win/issues/185

Results in D Drive - 






Monday, September 13, 2021

Sitecore 10 - Fix for deleted child items remain in the web database.

While working on the current project (Sitecore 10) with SXA, We have noticed that when we deleted a child item of the composite component ( like an accordion).

We also raised the Sitecore ticket and came to know a few suggestions like 

Option 1 

You can modify the RemoveUnknownChildren processor in publishItem pipeline to always check for deleted item by removing this line:

if (!ShouldProcess(context))

{

return;

}

Note that this might incur higher overhead for the publishing process.

Option 2

If editing the code is not feasible, you can first publish the pages with "publish related items" and "publish subitems" settings to publish the media items and data source items. Next, you need to publish the page and the Data item under the Site with "publish subitems" setting only to remove the deleted item from target database.

Please try these workaround and let me know if you need further assistance. Thank you.

As this is a critical functionality, here is the fix for this issue.



Create a patch file -


<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">

    <sitecore>

        <pipelines>

            <publishItem help="Processors should derive from Sitecore.Publishing.Pipelines.PublishItem.PublishItemProcessor">

                    <processor type= "CustomSolution.Project.SitecoreFix_Sitecore.Publishing.Pipelines.PublishItem.RemoveUnknownChildren, CustomSolution.Project.SitecoreFix_Sitecore" patch:instead="processor[@type='Sitecore.Publishing.Pipelines.PublishItem.RemoveUnknownChildren, Sitecore.Kernel']"/>

                </publishItem>

        </pipelines>

    </sitecore>

</configuration>

 and add a class 

using Sitecore.Data;

using Sitecore.Data.Items;

using Sitecore.Diagnostics;

using Sitecore.Publishing;

using Sitecore.Publishing.Pipelines.Publish;

using Sitecore.Publishing.Pipelines.PublishItem;


namespace CustomSolution.Project.SitecoreFix_Sitecore.Publishing.Pipelines.PublishItem

{

    public class RemoveUnknownChildren : PublishItemProcessor

    {

        public override void Process(PublishItemContext context)

        {

            Assert.ArgumentNotNull(context, nameof(context));

            Assert.IsNotNull(context.PublishContext, "context.PublishContext");

            foreach (ID unknownChildId in context.PublishHelper.GetUnknownChildIds(context.ItemId))

            {

                PublishingCandidate publishingCandidate = new PublishingCandidate(unknownChildId, context.PublishOptions)

                {

                    PublishAction = PublishAction.DeleteTargetItem

                };

                Item obj = context.PublishOptions.TargetDatabase.GetItem(unknownChildId);

                if (obj != null)

                {

                    publishingCandidate.ItemName = obj.Name;

                    publishingCandidate.ItemUri = obj.Uri;

                }

                context.PublishContext.DeleteCandidates.Enqueue(publishingCandidate);

            }

        }

    }

}

that will fix the issue and will not see any pending deleted items in the web DB.

Monday, August 23, 2021

Sitecore Best Practices (V10.1) 009 - Scriban best practices

I think we need to make sure to add the proper object null handling while using the scriban, as an example below.


{{ if  i_item.propertyname != "" }}

{{ end }}

or, in case if you are using the custom Scriban extension or trying to read the object property

{{ if object!= null }}

or 

{{ if object }} 


Add the proper formatting for the scriban scripts so it is easy to read 



Sitecore Best Practices (V10.1) 008 - Apply Sitecore patches and fixes.

It's always good to apply the Sitecore patch in the correct way so this can be easily tracked(identified) that what all fixes/patches applied.

Although Sitecore has a good practice to include the patch (.txt) file in the Sitecore-->shell folder so we can see all the applied patches.

I usually prefer to apply the patch with the below approach.

1. Create the hotfix folder in the solution root. example src-->hotfixes--> here I would prefer to create the categories like if the fix is related to Sitecore core, SXA forms etc, so create the folder accordingly.

2. For the search folder(feature) as mentioned in point #1, create a separate solution under the project.


Example -



Saturday, July 10, 2021

Sitecore Best Practices (V10.1) 006 - Helix should be everywhere, even for dictionary, settings, core etc.

There are a list of benefit of using the Helix, like keeping the module separe, upgrade point of view and so, It's highly recommend  that to create the Helix structure.





Example, If we wann add a new dictionay enty which is specific to a feature, Plesae create the proper folder structure as example below

Sitecore/System/Dictionary/Feature/ABC (Module Name/ FeatureName 

Same for the Core database.


Wednesday, July 7, 2021

Sitecore Best Practices (V10.1) 005 - Always keep the data clean and give it a proper name.

Sometimes working on the feature, we forget to remove the duplicate, orphan or redundant Sitecore content item, and it got sync as part of the content serialization. So we need to make sure that those should not be part of the serialization.


It  gives me an idea to create a custom PowerShell script based on the feature which takes the Sitecore serialization module configuration and checks each item if they are orphan or redundant or need any cleanup or not :) 


Sitecore Best Practices (V10.1) 004 - Module - Make sure to update the scaffolding for new variant or structure.

 It's general practice and recommendation that we should create the module if the site is going to be a multisite,


Sometimes we created a new variant for the existing component and missed including it under the branch template (scaffolding), so we need to update the structure based on the latest changes. Otherwise, the new site will not have all the latest changes.

Sitecore Best Practices (V10.1) 003 - Should understand and know the basic of BEM naming conventions for CSS (The Block, Element, Modifier methodology)

 It's very important as BE and FED we shoudl follow the proper naming convenstions. mostly for the BE we usually work on C# patterns but while working on the SXA feature, we need to make sure that we undrestand the basic of BEM naming convenstions.



These are the some example of good and bad practices -

http://getbem.com/naming/

Harry Roberts  - This is the main reason we end up with bloated code bases, full of legacy and unknown CSS that we daren’t touch. We lack the confidence to be able to work with and modify existing styles because we fear the consequences of CSS’ globally operating and leaky nature. Almost all problems with CSS at scale boil down to confidence (or lack thereof): People don’t know what things do any more. People daren’t make changes because they don’t know how far reaching the effects will be.

Philip Walton mentioned - While 100% predictable code may never be possible, it’s important to understand the trade-offs you make with the conventions you choose. If you follow strict BEM conventions, you will be able to update and add to your CSS in the future with the full confidence that your changes will not have side effects.

Again below lines are from the Harry Roberts 

There are a number of common problems when working with CSS at scale, but the major two that namespacing aims to solve are clarity and confidence:

Clarity: How much information can we glean from the smallest possible source? Is our code self-documenting? Can we make safe assumptions from a single context? How much do we have to rely on external or supplementary information in order to learn about a system?

Confidence: Do we have enough knowledge about a system to be able to safely interface with it? Do we know enough about our code to be able to confidently make changes? Do we have a way of knowing the potential side effects of making a change? Do we have a way of knowing what we might be able to remove?

There are a pleny of existing methodology to define the name like below

(Ref - http://getbem.com/introduction/)

  1. OOCSS - Separating container and content with CSS “objects”
  2. SMACSS - Style-guide to write your CSS with five categories for CSS rules
  3. SUITCSS - Structured class names and meaningful hyphens
  4. Atomic - Breaking down styles into atomic, or indivisible, pieces

The reason I choose BEM over other methodologies comes down to this: it is less confusing than the other methods (i.e. SMACSS) but still provides us the good architecture we want (i.e. OOCSS) and with a recognizable terminology.

Mark McDonnell, Maintainable CSS with BEM


 <section>  
   <h1>Sample Calculator</h1>  
   <form action="test.aspx" method="post">      
     <p>  
       <input name="amount">   
       <input type="submit" value="Calculate">  
     </p>  
   </form>  
 </section>  
 <section class="widget">  
   <h1 class="widget__header">Sterling Calculator</h1>  
   <form class="widget__form" action="test.aspx" method="post">      
     <p>  
       <input name="amount" class="widget__input widget__input--amount">   
       <input type="submit" value="Calculate" class="widget__input widget__input--submit">  
     </p>  
   </form>  
 </section>  


Here Section element is a block (widget) and 

widget__form - double underscore to recongnize that form is a part of widget

widget__input - double underscore to recongnize that input is a part of widget

widget__input--amount - amount is a variant of input


the complete css class will look like this 


 .widget {  
   background-color: #FC3;  
 }  
 .widget__header {  
   color: #930;  
   font-size: 3em;  
   margin-bottom: 0.3em;  
   text-shadow: #FFF 1px 1px 2px;  
 }  
 .widget__input {  
   -webkit-border-radius: 5px;  
     -moz-border-radius: 5px;  
      -o-border-radius: 5px;  
       border-radius: 5px;  
   font-size: 0.9em;  
   line-height: 1.3;  
   padding: 0.4em 0.7em;  
 }  
 .widget__input--amount {  
   border: 1px solid #930;  
 }  
 .widget__input--submit {  
   background-color: #EEE;  
   border: 0;  
 }  

Excellent example is here  -https://www.integralist.co.uk/posts/bem/#4

References-

  1. https://en.bem.info/methodology/naming-convention/
  2. https://css-tricks.com/bem-101/

Sitecore Best Practices (V10.1) 002 - When start a new feature don't include the .sln file and try to setup a VSIX (extension template)

 This is very very basic but just wanted to cover here, when we start a new feature don't involve the .sln (Solution) project as we have the main solution for the project.

I would sugget to create a new VSIX (extension template)


References -

  1. https://dzone.com/articles/creating-your-first-visual-studio-vsix-package
  2. https://docs.microsoft.com/en-us/visualstudio/extensibility/getting-started-with-the-vsix-project-template?view=vs-2019

Sitecore Best Practices (V10.1) 001 - Make sure to use the correct nuget packages.

 Recently, I was doing a development and came to know that we need to make sure to use the correct version of the dependent assembley, As a example of Newtonsoft which we generally used for the custom solution/feature, We need to make sure to use the same version which is being used by the current sitecore version.

We can see the version details here 

https://sitecore.myget.org/feed/sc-packages/package/nuget/Sitecore.kernel/10.0.0



Monday, July 5, 2021

Sitecore 10 - Solr field mapping - A quick view of AddDocument, AddRange, AddTypeMatch

 Recently, We got a few issue after applying the SCS fix patch and it stopped working a few filters, Usually for any filter we have identify the field name from the Solr.

Example - Filter


 How do we find the field exact name?


How the field mapping work, Sitecore has a pipelin 
Sitecore.ContentSearch.SolrProvider.SolrFieldMap

Configuration name  - Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config


This is happening while adding the document example as below


Here are the exact method for AddTypeMatch


Hope that will help to others to understand how Sitecore is adding the field name during the document add, It's supported out of the box in Solr after version 6.6 because of the managed schema, 



Sunday, July 4, 2021

Sitecore 10 - Fix for map component spelling mistake

I was working on creating a custom map component, while doing the implementation, I found a small spelling mistake, raised a Sitecore issue and they have mentioned that it will be fixed in upcomign release 


public reference number 486264

Thursday, July 1, 2021

Sitecore 8.2 - Quick Lucene Handy query with luke.

 I recently got a quick request to investigate and provide the fix for the search issue, had to download the luke and check the Lucene index.

A handy query 

_fullpath:"/sitecore/templates/feature/media/parameterstemplates/xxxx"



Tuesday, June 29, 2021

Sitecore 10 - Quick fix - Detected that item /Content - in the destination should be moved to XX but /XX was not a path included in any serialized subtree being synced.

While working on Sitecore 10 - You will see this error, it's common because if someone will change the location of the template or content still you may have that serialization file on your local.



the quick fix is the cleanup of your working branch and that will remove all untracked files or changes and do the ser push.


Monday, June 28, 2021

Sitecore 10 -docker: Error response from daemon: failed to create endpoint serene_perlman on network nat: failed during hnsCallRawResponse:

 Recently, I found this issue.  


The error is simply that the process is in use, I checked a few links and found this could be related to Linux and so but the actual issue is this particular port is in use.


I have simply updated the port for the verification and it worked fine for me.

Sitecore 10 -x509: certificate signed by unknown authority

 Recently, I got this issue while doing a new installation with Docker.


Fix - The docker container was running under the Linux, After changing the container to Window this issue got fix.

Friday, June 25, 2021

Sitecore 10 - Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine'

Recently, I was trying to set up a new test environment, I downloaded the package from the Sitecore Site, I did the init and while doing the docker-compose up -d, I got this error 

Error - Error response from daemon: Unrecognised volume spec: file '\\.\pipe\docker_engine' cannot be mapped. Only directories can be mapped on this platform


Starting searching for the solution - the first one was to remove the back slash

https://github.com/nicholasdille/docker/issues/1


didn't help me, below is the exact location where I can see it's complaining.


I found this is a common issue because one person has recently posted on stackoverflow-

https://stackoverflow.com/questions/68010612/error-response-from-daemon-unrecognised-volume-spec-file-pipe-docker-engi



Now, It's getting very interesting for me :) 

I removed all containers and tried to set up a new lighthouse repository and found new issues

services.smtp.scale must be a integer


I think I have noticed that I have the latest version of PowerShell on my machine, I have uninstalled and restarted it, but after the restart, init and compose-up, I got a new error, interesting day today!!



Now, I made one change here 


I think must be an issue with the Docker, or PowerShell etc, I checked the docker and tried to run one sample application (Not the Sitecore one).

docker run -d -p 80:80 docker/getting-started


Error Details - 

PS C:\WINDOWS\system32> docker run -d -p 80:80 docker/getting-started

WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (windows/amd64) and no specific platform was requested

38f2bb488cc23aa18b3aa3d4ec5fa865a2fd3e1dac19945304e15fcf07fe765b

docker: Error response from daemon: failed to create endpoint unruffled_goodall on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20).

I have changed the container to Linux and not got below warning

Digest: sha256:10555bb0c50e13fc4dd965ddb5f00e948ffa53c13ff15dcdc85b7ab65e1f240b

Status: Downloaded newer image for docker/getting-started:latest

a1d910768708a5221a179f05fdabf163b5625efe3ec9e59fd8e803ff1162bcb6

docker: Error response from daemon: Ports are not available: listen tcp 0.0.0.0:80: bind: An attempt was made to access a socket in a way forbidden by its access permissions.

 

I removed everything inside the docker using the below command

docker system prune

Ran the sample application and ran it successfully, I ran the Sitecore but it didn't work because of the Linux container 

no matching manifest for linux/amd64 in the manifest list entries

(Which is a common understanding because they have mentioned in the document that the container should be a window one)

Another issue -
time="2021-06-25T10:52:44+10:00" level=warning msg="network demo: network.external.name is deprecated in favor of network.name"

Found that external.name is deprecated but it's in use in the lighthouse demo here -



Reference URL: 

  1. https://docs.docker.com/compose/compose-file/compose-file-v2/
  2. https://github.com/docker/docker.github.io/issues/6453

 Uninstalled and installed Docker - and tried to run the sample application, Got below error 

docker: no matching manifest for windows/amd64 10.0.19042 in the manifest list entries.See 'docker run --help'.



The above issue got resolve when I updated the experimental mode =true, Now got one more issue


PS C:\Projects\Demo> docker run -d -p 80:80 docker/getting-started
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (windows/amd64) and no specific platform was requested
0df026cfa1bf9150741def5a9dbb252911bb7d4a68424db0574a49f543fd9156
docker: Error response from daemon: failed to create endpoint distracted_banach on network nat: failed during hnsCallRawResponse: hnsCall failed in Win32: The process cannot access the file because it is being used by another process. (0x20).





I did a complete new machine setup, and followed the steps mentioned in the installation document, downloaded the package from here - https://github.com/Sitecore/docker-examples
Ran the ini and docker-compose up command, got below error now


PS C:\sitecore\docker-examples\getting-started> docker-compose up -d

Pulling mssql (scr.sitecore.com/sxp/sitecore-xp0-mssql:10.1.0-ltsc2019)...

ERROR: Get https://scr.sitecore.com/v2/: x509: certificate signed by unknown authority

PS C:\sitecore\docker-examples\getting-started>

Continusly getting the below error already turned off the firewall

x509: certificate signed by unknown authority

Continusly getting the below error already turned off the firewall.

Got the answere here - https://sitecore.namics.com/failed-to-pull-sitecore-image-on-aks/

normally means that your Docker is running in Linux container mode

Now, I got one more error 

ERROR: failed to register layer: rename C:\ProgramData\Docker\image\windowsfilter\layerdb\tmp\write-set-043761389 C:\ProgramData\Docker\image\windowsfilter\layerdb\sha256\a7ba3db29ebb3a32e6a9c912d6ab5941bd981a0c39a420e6786c70a66babb80b: Access is denied.

PS C:\sitecore\getting-started> I provided all access and removed the read only access, but still it didn't work. Finally found that could be related to Antivirous.

https://stackoverflow.com/questions/41104410/pull-image-with-docker-on-windows-10-failed-to-register-layer-denied-acce



Removing the complete antivisous just to make sure if that's the reason.



Removing the antiviroush has resolved my issue.



I can see an image file here -C:\ProgramData\Docker\image\windowsfilter\layerdb\sha256


Saturday, June 19, 2021

Sitecore 10 - manifests/latest: unauthorized: incorrect username or password

 While doing a new setup with Docker, I recently got below error -

manifests/latest: unauthorized: incorrect username or password

Fix -  As the error says clearly that it's related to the authorization, I opend the window docker and logged into with my docker id and that got resolve my issue.


Monday, June 14, 2021

Sitecore 10 - SCS - Input string was not in a correct format - Serialization.ps1

Recently, I got the below error while doing the serpush, I got the latest from the master and trying to update my local setup.


 [master] Applying changes...

[master] [Batch 1] [[U] /sitecore/content/XXXXX/XXXX/Dev (An error occurred when executing task 'SerPush'.

Error: One or more errors occurred.

        Program 'dotnet.exe' failed to run: Input string was not in a correct format.At D:\Dev\XXXX\CakeFiles\Serialization.ps1:63 char:5

+     dotnet sitecore ser push

+     ~~~~~~~~~~~~~~~~~~~~~~~~.

Investigation- I ran the servalfix and got the successful message after that I again ran the serpush command got the same error :( 


I was using the cake project and now run the below command directly through the PowerShell (Admin mode)

dotnet sitecore ser push

and got the below message

[master] [Batch 1] [[U] /sitecore/content/XXX/XXX/Dev ({152E5954-E420-4509-A31B-F7BB19DE055D})] UpdateFieldItemCommand Field  (ID: {165ED632-7C9E-4555-A39D-8F76A6FA04FD}) received a set value command, but its value was already equal to the value to set. This indicates sending extraneous commands.

[master] [Batch 1] [[U] /sitecore/content/XXX/XXX/Dev ({152E5954-E420-4509-A31B-F7BB19DE055D})] UpdateFieldItemCommand Field  (ID: {1D4E9AC1-8BF9-4292-9BCF-3AB8DC677924}) received a set value command, but its value was already equal to the value to set. This indicates sending extraneous commands.

Solution -  I have to remove the content manually and re-run the ser push command that resolved the issue for me.



Tuesday, June 1, 2021

Sitecore 10 - Setup auto suggestion (Predication) with Solr Cloud using Docker

 Today, I got a requirement to set up the auto-suggestion (Predication) for the SXA search, here are the steps to configure.


There are three options available but we wanted to configure the predications one

By default the search box will give you 404 when we do the query.

As per the Sitecore Documents, We need to configure the Suggester component and handler

https://doc.sitecore.com/users/sxa/18/sitecore-experience-accelerator/en/walkthrough--adding-search-functionality-to-your-page.html


and the name should be sxaSuggester, Although we can define and override on our own in this example we are going with the OOTB.

 Sitecore has also provided an example here https://doc.sitecore.com/developers/90/platform-administration-and-architecture/en/using-solr-auto-suggest.html with the sample configuration but the catch is in the sample configuration the name of the suggested is mySuggester so we need to make sure to update the correct name otherwise the search API will give you 404.

Steps to update - Go to your Docker build folder Example path docker\build\solr\Sitecore.zip - Unzip the file and update the 



To reflect the changes make sure to rebuild the image using docker-compose build solr (name of your solr image)

do the initialization and up again, you can verify your changes in the Solr through the admin panel. browser the file.

Make sure to refresh the collection and you would see the result in the search text box, I have used the field sxacontent_txn so there are a few unwanted fields and you can mention those field in the protected word to exclude from the search (I'm exploring more option to have a more purified suggestion and will update soon).

Let me know if you are implementing the prediction and found any issue, Happy to discuss and help.

Here is my SXA search in-depth review video that I presented in one of the Sitecore User Group -