Tuesday 23 November 2021

Steps to setup SearchStax in Sitecore for multi-site

Previously we setup SearchStax with Fresh Sitecore Instance and that will fulfill requirement for one Search Page on Single-site Sitecore Instance.

Now there will be scenarios like

  • Global Search page that will list result from Multi-Site
  • For each Site(In multi-Site), there will be Separate Search Pages

In this article, will implement Global Search Page that will list result from Multi-Site

Steps to Setup Global Search Page will be same as previous article SearchStax with Fresh Sitecore Instance.
Only need to update root entry and update by adding multiple root entries while Creating SearchStax Index as below




Hope this help.
In next article we will setup multi Search pages for each Site.


Step by Step to Setup SearchStax with Sitecore

In this article, We will do setup SearchStax with running Sitecore Instance. 



Setup Prerequisites

  • Sitecore Instance must be up and running (where we will be setting up SearchStax)
searchstax-compatibility
  • Before Installation, please collect SearchStax's Credentials for 
    • SearchStax Portal
    • Collect Search and Suggest API URL from https://searchstudio.searchstax.com/apps-management Search API Section
    • Solr read-only and Admin (Username/Password) from below Location
    • To get Index Core Name - Go to Search URL from https://searchstudio.searchstax.com/apps-management Search API Section. For example: https://xxxxxxx.searchstax.com/solr/Index-Core-Name/emselect



Steps to Setup Searchstax
  • Login to Sitecore Instance
  • Install Searchstax module as per compatibility (Can take reference from above Prerequisites)
  • Once package installation done, configure Searchstax index from Launchpad View or by URL https://YourInstance/searchstax/configuration
searchstax-index-configuration


searchstax-index-configuration

  • Once clicked on Sitecore Module Configuration, will see below screen. After this click on Create An Index and fill all details (As per mentioned, in above Prerequisites)

searchstax-index-field-details


  • Once Index creation done, Go to Control Panel and trigger below action
    • Click on Populate Solr Managed Schema (select only SearchStax Index)
    • Index Managed (select only SearchStax Index)


  • Now From Searchstax setup is done. To verify with Sitecore will add Search Page Item and then Publish Search Page.



Hope this was easy and helpful to you. Please share if face any challenge during Setup.

Note:
  • Please make sure to save and Publish after every Change.
  • All above Steps must need to be done sequentially.
  • After Every Changes in configuration File, Need to Click Reload Schema from Searchstax Portal.

Sunday 14 November 2021

Introduction to SearchStax - Search with Sitecore

There are various providers to implement Search with Sitecore Instance. Today's article will help to understand about Searchstax with Sitecore.

Currently we have options as provider to implement search like - Lucene, solr, azure. Also tools that makes search Implementation easy, fast and with analytics features - Coveo & Searchstax.

But with my experience on Searchstax there are below points as feature which makes it unique and reason to use Searchstax.

1. Readymade Search (ready to use with any Sitecore project in next 10 mins) with Multi-site options - with no code change required.

2. Easy interface to manage analytics and only Integration activity from Sitecore CMS.

3. Custom Search Page Implementation (Can change any existing Custom search page provider connection from existing to SearchStax search API)

searchstax-sitecore


There are also list of features with SearchStax to use for Search analytics

facet, sort, hit highlighting

Stop words, synonyms, spell check and auto-suggest

Field boosting, rules and Promotions

Reporting options on Search analytics

Readymade search page theming, Preview feature on Search page.


Benefits to use Searchstax for search

High availability, no field limits

Search item's click or searched key level tracking

No-additional pre-requisites skill required for developers

 

There is no change for below points

for computed index, there is no change in code/configuration to implement.

Field/Template include/exclude configurations are same as with other providers.

Connect to any environment search index from developer's machine.

From developer's machine - index setup and code debugging as very easy [bcz of search endpoint API].


Friday 1 October 2021

How to fix Sitecore xConnect 403.16 issue ?

In this article, will share steps to fix issue - Sitecore xConnect throwing 403.16 - forbidden

Below are the steps to resolve:

1. go to IIS and select your instance's xConnect site. (Let's say mylocal.xconnect)

2. double click on SSL Setting


3. update settings as below

4. Now hit your instance, (e.g. https://mylocal.xconnect)

Hope this work. If still issue please comment.




Wednesday 29 September 2021

How to get url web status in bulk ?

 In today's article, would like to present script. And the purpose of this script to Get url web status in bulk.




Recently I was chasing few issue that random pages throwing 404/500/400. So thought to prepare a script and get list of items with their current status also can be re-used after period of time.

Steps to Execute:

1. Please find script by click here

2. Please update list of urls in one file and placed at one place (Let's say D:/urls.txt)

3. Open PowerShell and execute script as .\urlhealths.ps1


Note: 

     Please do not forget to update path in script to get url list (line no. 42)

     Also please ensure urls.txt contains list of url (one url in one line)


Hope this will help.


Saturday 11 September 2021

Custom data source on Sitecore template field

 Actually there are many ways to apply data source on Template's Field, Rendering Item, Rendering data source Location and Rendering parameter. 

  • using sitecore data item path/id
  • using sitecore query/fast-query
above both - most used ways.

But there are many scenarios, where after applying data source path wanted final list after modified data by type, filtering, custom code logic or any dynamic logic on data source .


Custom class as data source
We can do this activity as well using custom class, and we can call them on 
 by setting data source Field value as

code:Sitecore.CustomDataSources.UpdateDataSource,Sitecore.CustomDataSources

custom-data-source-sitecore-template-field


PowerShell script as data source
There are also another way to do this using PowerShell script.

by setting data source value as 
script:/sitecore/system/Modules/PowerShell/Script Library/CustomDatasource

and place your PowerShell script at above location with File name as CustomDatasource



Hope this will help.

Friday 27 August 2021

Sitecore dropdown fieldtype validation

In this article, we will try to achieve droplink's field validation. So to before start there is a concept that sitecore droplink actually store item's ID.

And to achieve this we have to apply validation on dropdown fields, just apply regex there as ^.{38}$. 



Please see below screenshot



Hope this will help.



Tuesday 24 August 2021

git pull error: cannot stat Filename too long

In this article, we are going to discuss about an issue related to GIT
that while trying to take latest from one of the branch. And after pull command facing issue as 

git pull error: cannot stat Filename too long

Also noticed that other teammates have not this issue.

After spending some time on this issue found the fix, so thought to share with community.

Fix:

just open GIT Command prompt

first I tried git pull but the same issue because of Windows API limitation of file paths having 260 characters or fewer.

To fix this issue ran below command

git config --system core.longpaths true

after this trigger git pull and it works.


Hope this will help

Friday 30 July 2021

Sitecore control panel local indexes issue - indexes not listing

In this article, we are going to explain about very common issue -  local indexes issue

Few days back, I was also facing same issue that while trying to rebuild one of index from control panel.
There were no index listed on Indexing manager.

As I have attached screenshot



After looking at configs and running services.

Found that core name are not correct (as compare to search engine).
Since we are using solr, so we looked configs as

App_Config/Sitecore/ContentSearch/

~/Sitecore.ContentSearch.Solr.Index.Master.config

~/Sitecore.ContentSearch.Solr.Index.Web.config

~/Sitecore.ContentSearch.Solr.Index.Core.config 

and compared core with Solr admin portal (my instance solr url is : https://localhost:8983)

and correcting corename into configs, indexes started listing.


Hope this will help.

Thursday 17 June 2021

Rich Text Editor “Object reference not set to an instance of an object.” Issue



 There are situation, where on the click of show editor button for RTE field on an item may get issue as 

Rich Text Editor “Object reference not set to an instance of an object.” yellow screen error as popup


To resolve this issue there are few approach to verify (is there any item missing in CORE DB)

Apporach-1:
In Sitecore CMS, switch to Core db from right botton (Desktop view screen).
After that go to path /sitecore/system/Settings/Html Editor Profiles and verify that all expected RTE items exist or not?

Can check number of RTE items from working same instance (from other upper env, dev instance).

If any mismatch, then create package from there and installed at target instance.

IT works for me.

Apporach-2:


and see issue, if it works then approach 1 will be the fix.


Hope this will.

Friday 4 June 2021

Sitecore solr MaxBytesLengthExceededException issue while index rebuild

While triggering index rebuild from Sitecore control Panel, may get below issue as

SolrNet.Exceptions.SolrConnectionException: <?xml version="1.0" encoding="UTF-8"?>

<response>

<lst name="responseHeader">

<int name="status">400</int><int name="QTime">2147</int></lst><lst name="error">

<lst name="metadata"><str name="error-class">org.apache.solr.common.SolrException</str>

<str name="root-error-class">org.apache.lucene.util.BytesRefHash$MaxBytesLengthExceededException</str></lst>

<str name="msg">Exception writing document id sitecore://web/{629c0a43-8382-4aa6-10e8-eb2c0fd5460a}?lang=en&amp;ver=2&amp;ndx=YOUR_INDEXNAME

to the index; possible analysis error: Document contains at least one immense term in field="INDEXEDFIELDNAME" (whose UTF8 encoding is longer than the max length 32766),

all of which were skipped.  Please correct the analyzer to not produce such terms.  The prefix of the first immense term is: '[72, 117, 109, 97, 110, 32, 82, 101, 115, 111, 117, 114, 99, 101, 115, 32, 124, 32, 52, 48, 48, 32, 124, 32, 50, 53, 32, 124, 32, 87]...', 

original message: bytes can be at most 32766 in length; got 58214

Perhaps the document has an indexed string field (solr.StrField) which is too large</str><int name="code">400</int></lst>

</response>

 ---> System.Net.WebException: The remote server returned an error: (400) Bad Request.


Possible Fix:

As I tried to highlight useful information from above log and it seems that we are facing size issue for string Field type in solr.

string Field have max size of 32K (32766) and trying to store 58214 char that is why got exception.

one solution is to change fieldType

From the computed Index configuration file, change returnType for indexField as "Text" after removing "String"

This works for me, hope for you as well.

another solution is to bypass index for this particular file. For that there is a setting in config StoreLocation="true" but I do not feel this will be good approach.

Wednesday 2 June 2021

Install-SitecoreConfiguration : Cannot validate argument on parameter 'Signer'. The “$_.HasPrivateKey -eq $true”

 Are you facing below issue while setting fresh Sitecore (9.x version) instance ?

Install-SitecoreConfiguration : Cannot validate argument on parameter 'Signer'. The “$_.HasPrivateKey -eq $true”



Then I would suggest to follow below steps sequentially as

  • Close PowerShell session, where installation were going on.
  • Remove/cut to other location all certificates from C://certificates
  • go to installation path and open xconnect-createcert.json
  • Now search key named as StoreLocation in this file
  • and then change value as LocalMachine


Hope this will help to resolve above issue.


Tuesday 1 June 2021

Install-SitecoreConfiguration : Missing required parameter: name

This may be one issue at the time of Sitecore instance setup and to resolve this issue, please follow below steps

Open and update files for 

  • sitecore-XP0.json
  • xconnect-xp0.json


and once opened file, search "Arguments": { "Name" 

If found then replace with "Arguments": { "name" and save.


Now execute installation script again, hope this will help.

Tuesday 25 May 2021

Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Unrecognized escape sequence

 If facing below issue at the time of Sitecore instance setup


Install-SitecoreConfiguration : Cannot retrieve the dynamic parameters for the cmdlet. Unrecognized escape sequence.


Then would suggest to update files for

xconnect-xp0.json

sitecore-XP0.json

scinstall.ps1 (in your case, installation script file name may be different)


by searching '\' in above files and replace with "\\" in file path

for example: 

earlier setting was 

$PSScriptRoot\Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip

and replaced with 

$PSScriptRoot\\Sitecore 9.0.2 rev. 180604 (OnPrem)_single.scwdp.zip


and once all settings updated in script, then execute again.


Hope this will help.


Wednesday 12 May 2021

How to remove all data from Sitecore Solr index ?

Challenge:

Few days back, was working on sitecore solr search related issue that 


From solr portal, was able to retrieve data from index even deleted items (solr index caching issue).

But in the code getting null value for item's properties.


Tried many alternatives to resolve issue (IISRESET, config review, code debug, index rebuild), but no luck.


Approach to fix above issue:

After removing all data from solr index, and then index rebuild issue was resolved.




Steps:

1. From browser open hosted solr portal

2. choose index

3. go to document tab


or copy below URL and hit

1. https://localhost:8987/solr/your_index_name/documents


after this


choose Document Type as Solr command (raw xml or JSON)

then paste query

<delete><query>*:*</query></delete>

and Submit document.

Wednesday 5 May 2021

How to get license details for a Sitecore instance using Sitecore PowerShell script ?

Since I was trying to get license details for a Sitecore instance, so thought to share with all.


below are ways to get Sitecore license details using Sitecore PowerShell script as

$licensePath = [Sitecore.Configuration.Settings]::LicenseFile
[xml]$licenseDocument = Get-Content -Path $licensePath
$licenseDocument.signedlicense.Signature.Object.license |Format-Table -AutoSize



Tuesday 4 May 2021

How to read list data from file, using Sitecore PowerShell script

Challenge:

There were scenario, where I was trying to get list of strings from text file and tried as below

[string[]]$ItemIdList = Get-Content -Path 'D:\ItemIds.txt'

but getting issue as file not found.


Approach to resolve:


With below lines of script, trying to first upload at temp/upload path (it will create directories if not exist).

And then reading list of strings from text file.

$dataFolder = [Sitecore.Configuration.Settings]::DataFolder
$tempFolder = $dataFolder + "\temp\upload"
$filePath = Receive-File -Path $tempFolder -overwrite'
[string[]]$ItemIdList = Get-Content -Path $filePath

Friday 23 April 2021

How to get list of items with linked items using Sitecore PowerShell script ?

I was trying to get list of items with directly linked items using PowerShell script.
Since from Sitecore content editor at a time can see linked items only for individual items, so thought to share with all.

Below is the script hope, this will help

    
$allImages = Get - ChildItem - Path 'master:/sitecore/media library/Images' - recurse
$results = @();
$allImages | ForEach - Object {
    $sproperties = @{
        SID = $_.ID
    }

    $referer = Get - ItemReferrer - ID  $sproperties.SID
    $properties = @{
        Name = $_.Name
       ID = $_.ID
       Path = $_.ItemPath
       LinkedItemIds = $referer.ID
    }
    $results += New - Object psobject - Property $properties
}

$results | Select - Object - Property Name, Path, LinkedItemIds

Wednesday 10 March 2021

Sorry, there was an error : unauthorized_client Sitecore

Issue

Sometimes, after fresh instance setup maybe getting error on the login screen


sitecore-login-issue


Fix

1. go to C:\inetpub\wwwroot\<identityServer Instance Name>\Config\production\Sitecore.IdentityServer.Host.xml

2. update AllowedCorsOriginsGroupN values from http to https

3. AppPool recycle



Now check, hope this will work.

Tuesday 9 March 2021

Sitecore Forms are not displaying Issue

Problem

While working with Sitecore forms  9.x version, We usually face issue that sometime Forms not display.
To resolve this issue we generally do index rebuild. Even after this form still not displaying.


Root cause

        Generally this issue occurs because of indexAllFields set as False. 


Fix

Please click here to download patch config and add at your path ~/App_Config/Include/zzz


Note: This fix will work for any of azure/solr/lucene search providers.

Hope this works.

Monday 8 March 2021

Sitecore dictionary item not getting phrase value intermittent issue

While working with Sitecore dictionary items, there are scenarios where not getting phrase value for dictionary items. And this issue intermittent(occasional type) not always facing this issue.

After spending time to find root cause of this issue - found that it's because of Dictionary Caching Issue.

And to resolve issue, there are several ways - can choose as per your fit.



1. Solve this issue by doing Global Change - Reset Dictionary Cache at application level

Please put below line of code in your application startup file

Sitecore.Globalization.Translate.ResetCache(true)


2. Solve this issue by Manual Steps - Reset Dictionary Cache

  • Shut down your app pool
  • Remove dictionary.dat from webroot/temp/ folder
  • Start your app pool again

3. Solve this issue by inserting custom pipeline - On Publish event reset dictionary cache.

update below config in Sitecore.config directly or add as new patch config inside (~/App_config/Include)

<event name="publish:end">

<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">

<sites hint="list">

<site>website</site>

</sites>

</handler>

<handler type="CustomNamespacePath, Customdll" method="CustomMethodName"/>

</event>


<event name="publish:end:remote">

<handler type="Sitecore.Publishing.HtmlCacheClearer, Sitecore.Kernel" method="ClearCache">

<sites hint="list">

<site>website</site>

</sites>

</handler>

<handler type="CustomNamespacePath, Customdll" method="CustomMethodName"/>

</event>


After above config change, write logic to reset dictionary cache in your custom class  which will mention in above config file.




Hope this will help, please share your thoughts - incase of any better approach/feedback.

Thursday 18 February 2021

How to view Sitecore content delivery showconfig.aspx

All Sitecore configuration get compiled and consolidate in showconfig.aspx file. And this config is the best way to verify default or custom configuration using

https://sc101.cm/sitecore/admin/showconfig.aspx

But recently we were facing configuration issue on CD server since there were no default way to verify showconfig.aspx on content delivery server.


Just to hack this and look showconfig.aspx for content delivery server please follow below steps:


1. Download config click here and save to your instance path wwwroot/sc101.cd

2. From Talend API Tester/Postman, put below input to get output(CD server showconfig.aspx as response) as below screenshot


sitecore-content-delivery-showconfig





Method Type: GET

URL: https://YourInstanceName/sitecorecontentdeliveryshowconfig.aspx

Header keys apikey: 464799ae52214c80b7fc81408f8efbe0




Now check your output. Hope this help.

Wednesday 17 February 2021

How to create sitecore custom index ?

With Sitecore, If there are lots of data on the instance where search needed, then Sitecore default index will not be good because it will be time and memory consuming.

In that case - creating custom index will be better approach which contains only searched items.


Let's start with creating solr custom index


Go to your solr installed location by copying sitecore_web_index and rename with sitecore_custom_index [<instancename>_web_index - so don't confused with sitecore]



once copied, then open core.properties and update name property under this directory as below screenshot



after above changes, restart solr service.

Now go to path \App_Config\Sitecore\ContentSearch and copy Sitecore.ContentSearch.Solr.Index.Web.config and rename with Sitecore.ContentSearch.Solr.Index.Custom.onfig as below


once file created open update settings for 
indexname, rootpath, which items wanted to include and exclude in index. as below



Let me know if feel any issue or feedback.

Tuesday 16 February 2021

Could not find add method: AddPrefetch (type: System.String)

 Issue:

After the initial unicorn setup with Sitecore instance, there may be a chance to get below issue

Could not find add method: AddPrefetch (type: System.String)

and there is no more information into log files. 



Fix:
To resolve this issue, 
ensure ranbow.*.dll, unicorn.*.dll, configy.dll and Kamsar.WebConsole.dll properly deployed in wwwroot/instancename/bin directory.