Tagged: Solr

Algolia Search Provider for Sitecore 10.2.1

Algolia Search Provider for Sitecore 10.2.1

The Algolia Search Provider for Sitecore is a powerful integration combining robust content management capabilities with Algolia’s lightning-fast, full-text search engine.

This provider enables Sitecore-driven websites and applications to deliver instant, relevant, and highly customizable search experiences to end-users, ensuring faster content discovery and improved user engagement.

While exploring, I found that Dmitry Harnitski and Peter Procházka have implemented the Algolia Search Provider for Sitecore 9.1 and previous versions. Thank you so much!

https://github.com/dharnitski/Sitecore.Algolia

https://github.com/chorpo/Sitecore.Algolia/tree/sitecore91

Upgrading to Sitecore 10.2.1

The following are the steps taken for upgrading Sitecore 10.2.1 – 

  •  I forked from Peter Procházka’s Sitecore 9.1 branch

https://github.com/chorpo/Sitecore.Algolia/tree/sitecore91

  • Upgraded the Sitecore NuGet packages to 10.2.1.

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-1.png

  • Algolia.Search NuGet package upgraded 6.12.1

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-4.png

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-2.png

  • Finally, able to build the solution successfully. 

Sitecore-Algolia-Search-Provider-10-2-1-Upgrade-3.png

  • After the build was successful, I shifted the module to the existing solution.
  • I didn’t get a chance to upgrade the unit test project. If you have upgraded, please let me know.

The module is checked into the following repository.

https://github.com/Madhumidha/Sitecore.Algolia/tree/Sitecore1021

The repo has all the instructions on how to set up and configuration details.

Hope this helps.

Happy Sitecoring!

 

0

Sitecore Forms : Custom Submit Action to Create and Publish Content Item (Part 2)

In Part 1, we saw

  • Create Custom Submit Action in Sitecore
  • Create a code-behind class that inherits SubmitActionBase
  • Create a secure API that can create and publish an item

https://madhuanbalagan.com/sitecore-forms-custom-submit-action-to-create-and-publish-item-from-form-data-part-1

Now, let’s focus on 

  • Create a separate Authorization in the Identity Server for Forms 
  • Create a Controller to bridge between Custom Submit Action and API call
  • Set the Custom Submit Action fields

1. Create a separate Authorization in the Identity Server for Forms 

Add the FormsServerClient node and its value to the Identity Server’s Sitecore.IdentityServer.DevEx.xml file. After making the change, make sure to IIS Reset for the change to be in effect. 

Note: Don’t forget to add transforms for ClientSecret!

 

Ideally, you can call it in Postman to verify that it’s generating a token using Form’s ClientID and ClientSecret values mentioned in the Sitecore.IdentityServer.DevEx.xml file.

Now that the config is all set to have its own ClientID and ClientSecret, let’s set up the Authorize method with BearerToken specifically for Form’s Identity Credentials.

The SitecoreRestServices handles authenticated HTTP requests to Sitecore’s REST APIs, managing access tokens and retrying requests if authentication fails. It uses dependency injection to configure the HTTP client and obtain the necessary settings.

2. Create a Controller to bridge between Custom Submit Action and API call

Let’s bridge the Custom Submit Action and API call – The CustomController class extends SitecoreController and uses dependency injection to obtain an instance of ICreateAutoPublishService.

It defines a CreateAndPublish method – HTTP POST endpoint that processes CreateAndAutoPublishModel, calls the service to create and publish content, and returns a JSON response indicating success or failure.

The method includes error handling to return appropriate HTTP status codes and messages for different exceptions.

3. Set the Custom Submit Action fields

The final step – Let’s set the Model Type and Error Message based on the class we created. 

Publish the form and its related items. It should be good to go!

Hope this helps.

Happy Sitecoring!

0

Sitecore Forms : Custom Submit Action to Create and Publish Content Item(Part 1)

 

Problem

I encountered a situation that the website was internally facing, which needed a form that would not save the data in the Experience Forms database. Also the data needs to be saved as an Item in the master database so it could be published and consumed in a listing page.

At first, I considered creating a Custom Submit Action to create and publish an item. However, I later realized that the CD server lacked access to the CM server, preventing it from directly generating an item in the master database. So, I came up with the idea of creating a custom API service and combining it with a custom submit action.

Solution

To implement this followed this process

  • Create Custom Submit Action in Sitecore
  • Create a code-behind class that inherits SubmitActionBase
  • Create a secure API that can create and publish an item
  • Create an API authorization user in the identity server 
  • Create a Controller to proxy between Custom Submit Action and API calls
  • Set the Custom Submit Action fields

 

1. Custom Submit Action in Sitecore

Create the custom submit action in the following path /sitecore/system/Settings/Forms/Submit Actions.

Sitecore_Forms_1.png

 

2. Create a code-behind class that inherits SubmitActionBase

Create a class that inherits the SubmitActionBase class and overrides the Execute method which calls the API asynchronously to create and publish an item.

The CreateAndAutoPublish class extends SubmitActionBase<string> and is designed to handle form submissions in Sitecore, creating and auto-publishing content items.

It uses dependency injection to obtain instances of IHttpClientFactoryBaseSettings, and ISitecoreRestServices, which are lazily initialized. The ExecuteAction method validates the form submission context and parameters, then calls the Execute method to prepare a model from form fields, serialize it to JSON, and send it to a Sitecore API endpoint using an HTTP POST request.

The class includes helper methods to extract values from form fields and handles errors by logging them and adding them to the form submission context’s error collection.

 

3. Create an API call that creates and publishes the item  

The API call does the following things – 

  1. Creates an item under a specified folder
  2. Move and Sync the item into a bucket
  3. Publish the item
  4. Clear the Sitecore cache
  5. Ensure the published item is indexed or force index the item
  6. Clear the Vercel Cache for frontend

In Part 2, we will see how to

  • Create an API authorization user in the identity server 
  • Create a Controller to proxy between Custom Submit Action and API calls
  • Set the Custom Submit Action fields

Hope this helps.

Happy Sitecoring!

1

2024 – Contributions

The 2024 year has been great with presenting at Sitecore Symposium, and various Sitecore User Groups worldwide. 

Symposium Presentation: 

 

Blog Posts : 

 

Presentations : 

 

Contributions: 

  • Dec 22, 2023 – Feedback/Review for Sitecore Content Hub Administrator Certification Exam – 
  • Dec 15, 2023Feedback for Sitecore MVP Program – 
  • Mar 01, 2024 – Sitecore CDP & Personalize Certification Exam Beta review
  • April 19, 2024 – Reviewed Sitecore Dev 10 Beta Exam

 

 Co-organized SUG-Pittsburgh Meetups: 

 

YouTube – Videos published for SUG – Pittsburgh  

  • Jan 02, 2024Abstracting personalization – CP
  • Mar 20, 2024Sitecore XM Cloud 101 – A Beginner’s Guide
  • Apr 03, 2024From Brainstorm to Brilliance: The Untold Story of Sitecore Hackathon
  • Apr 12, 2024Sitecore XM Cloud Forms
  • May 6, 2024Achieving Behavioral Personalization with XM Cloud Plus 
  • May 22, 2024Sitecore Search and XM Cloud – Experiences and Learnings
  • June 11, 2024Tips and Tricks for Next.js and Sitecore Headless
  • Aug 5, 2024 Content Hub Web Client SDK – Internal & External Integrations
  • Sep 3, 2024Sitecore Troubleshooting 101
  • Oct 8, 20248 Content Migration Pitfalls to Avoid and Lessons Learned

 

Co-organized SUG-Philadelphia Meetups: 

 YouTube – Videos published for SUG – Philadelphia 

 

Conferences I attended: 

  • Symposium 
  • MVP Summit 
  • MVP Lunches   
  • MVP Webinars 
  • All SUG Pittsburgh and Queen City meetups  
  • Many SUG Boston/ Columbus/ Atlantic meetups   

 

Plans for 2026: 

Learn and contribute: 

  • Composable DXP 
  • Sitecore Saas Offerings 
  • Containerization 

Co-organize : 

  • Monthly SUG-Pittsburgh meetup 
  • Quarterly SUG-Philadelphia meetup 

Present: 

  • SUGCON EU/Symposium 
  • SUG Meetups 

Happy New Year! Happy Sitecoring!

0

Sitecore: Apache Tika Integration for Secure Media File Indexing

Sitecore-Apache-Tika-Integration-Secure-Media

Problem

We have some secure PDFs in Media Library that were not getting indexed in Solr – They couldn’t be extracted using the PDFSharp library.

The logs were showing the error while extracting secure files

16804 12:04:53 ERROR DefaultMediaItemTextExtractor: Cannot extract content from media item with id ‘{442006A5-8CB6-4ABE-8855-786D2A870201}’.
Exception: PdfSharp.Pdf.IO.PdfReaderException
Message: The PDF document is protected with an encryption not supported by PDFsharp.
Source: PdfSharp
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.ValidatePassword(String inputPassword)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider provider)
at Sitecore.ContentSearch.ContentExtraction.Readers.PdfSharpReader.ReadAll(String filePath)
at Sitecore.ContentSearch.ContentExtraction.Common.DefaultMediaItemTextExtractor.ExtractTextFromMedia(MediaItem mediaItem)

38536 12:04:53 ERROR DefaultMediaItemTextExtractor: Cannot extract content from media item with id ‘{442006A5-8CB6-4ABE-8855-786D2A870201}’.
Exception: PdfSharp.Pdf.IO.PdfReaderException
Message: The PDF document is protected with an encryption not supported by PDFsharp.
Source: PdfSharp
at PdfSharp.Pdf.Security.PdfStandardSecurityHandler.ValidatePassword(String inputPassword)
at PdfSharp.Pdf.IO.PdfReader.Open(Stream stream, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider passwordProvider)
at PdfSharp.Pdf.IO.PdfReader.Open(String path, String password, PdfDocumentOpenMode openmode, PdfPasswordProvider provider)
at Sitecore.ContentSearch.ContentExtraction.Readers.PdfSharpReader.ReadAll(String filePath)
at Sitecore.ContentSearch.ContentExtraction.Common.DefaultMediaItemTextExtractor.ExtractTextFromMedia(MediaItem mediaItem)

 

Solution

  • If you like to index the media content, Sitecore recommends using the following libraries IFilter, Apache Tika, or SolrCell. 

https://www.searchstax.com/docs.hc/can-we-use-apache-tika

  • Azure web apps have a limitation in using the IFilter library so I ended up using Apache Tika.

Steps to Integrate:

  • Download the Apache Tika server file –tika-server-1.22.jar.
    • Sitecore recommends Apache Tika version 1.22 refer to the compatibility table for your version
  • Save the server file in a folder on SOLR server e.g: c:\tika
  • In PowerShell navigate to the path and execute the following command to install.

java -jar tika-server-1.22.jar

Sitecore-Apache-Tika-Solr-Indexing.png

Note: The default hostname is localhost and the port is 9998.

If you would like a specific hostname and port number that could be included in the installation command as parameters

 java -jar tika-server-1.22.jar –host=<Tikahostname> –port=<portnumber>

After the installation is completed open the following URL http://localhost:9998 to see if it is working as expected. You should see the welcome message!

Sitecore-Apache-Tika-Solr-Indexing-2.png

  • Add the following patch file into App_Config/Include/zzz folder to replace DefaultMediaFileTextExtractor from Sitecore.ContentSearch.ContentExtration.

 

 

  • Last step – Let’s add Tika URL into ConnectionStrings.config file.

<add name=”tika” connectionString=”http://localhost:9998″ />

  • Let’s test quickly – Rebuild a Tree in the Developer Ribbon for one item or you could Rebuild the entire index.
  • Once the indexing is completed check and see if we have the media item available in the index.

Quick Tip: To search for a particular item in Solr, use the following query in the parameter q on your index page

_uniqueid:*[item id in lowercase without braces]*

 Sitecore-Apache-Tika-Solr-Indexing-3.png

Hope this helps.

Happy Sitecoring!

1

Quickly Setup Sitecore 10.3 XM with SIA

The latest version Sitecore 10.3, is packed with new features and enhancements that make it easier than ever to manage your digital content and deliver personalized experiences to your customers.

If you’re looking to install Sitecore 10.3 XM, one of the easiest ways to do it is by using the Sitecore Install Assistant (SIA). In this blog post, let’s walk through the steps to install Sitecore 10.3

Prerequisites:

  • A Windows machine with a minimum of 16GB of RAM
  • Microsoft SQL Server 2017 or later
  • IIS 10 or later
  • .NET Framework 4.8 or later
  • Microsoft PowerShell 5.1 or later

Preparation:

  • Download the installation package (Graphical setup package XM scaled) from here.

Sitecore_10_3_Installation_XM_Headless_Download

Installation:

  • Extract the downloaded zip file

Sitecore_10_3_Installation_XM_Headless_Setup_exe

  • Right-click on the Setup.exe and execute in Administrator mode

Sitecore_10_3_Installation_XM_Headless_Start

  • Install the prerequisites 

Sitecore_10_3_Installation_XM_Headless_Prerequisites.png

  • Install Solr 8.11.2 by entering the Port, Windows service path prefix, and Install path

Note: Make sure the port number differs from earlier Solr-installed versions. Check out my blog to discover which processes are using which ports – https://madhuanbalagan.com/sitecore-10-sif-installation-roadblocks

  • Solr installation is successful!

Sitecore_10_3_Installation_XM_Headless_Solr_Complete.png

  • Fill out the Site prefix, admin password(going with bso easy to remember), and choose the Sitecore license file

Sitecore_10_3_Installation_XM_Headless_Sitecore_Settings.png

  • Fill out the SQL server Instance name, admin username, and password.

Sitecore_10_3_Installation_XM_Headless_SQL_Server_Settings-1.png

  • It auto-fills Solr URL, System root, and Windows service name

Note: Navigate to Solr URL and ensure it’s running as expected

Sitecore_10_3_Installation_XM_Headless_Solr_Settings.png

  • Select the optional module if you plan to create a Headless SXA site

Sitecore_10_3_Installation_XM_Headless_SXA.png

  • Review the summary to make sure the settings are correct

Sitecore_10_3_Installation_XM_Headless_Summary.png

  • The Installation wizard in SIA validates all the settings before starting the install

Sitecore_10_3_Installation_XM_Headless_Validate.png

  • Installation takes around 10-15 minutes (you can get a coffee!). If it errors out, check out the log.

Sitecore_10_3_Installation_XM_Headless_Install.png

Yayy! It’s successfully installed. Is it easy to install with SIA? It’s indeed a great tool!

Sitecore_10_3_Installation_XM_Headless_Install_Completed.png

Let’s log in and explore!

Sitecore_10_3_Installation_XM_Headless_Login_Success.png

 

Roadblocks:

Error # 1: Solr access to the path denied

Solr installation failed with error – Access to the path ‘C:\Users\MANBAL~1\AppData\Local\Temp\solr-8.11.2\server’ is denied.

Sitecore_10_3_Installation_XM_Headless_Rendering_Error.png

 

Resolution:

I wasn’t running at the setup.exe in Admin mode. Ran in Admin mode (restarted the machine just in case) fixed the issue.

 

Error # 2: Unable to create core index

Error CREATEing SolrCore Unable to create core [wc10.3.xm.local_core_index] Caused by: Can’t find resource ‘solrconfig.xml’ in the classpath or ‘C:\Solr\Solr.8.11.2solr-8.11.2\server\solr\sc10.3.xm.local_core_index’

 

Resolution:

Do not use the same port used for the earlier installation. For some reason, it doesn’t work. Always use the new port and new Solr instance name.


Now that we installed Sitecore 10.3 XM, I’ll be installing Sitecore Headless Rendering (previously known as the JSS module) in my next blog post.

Hope this helps. Happy Sitecoring!

3

Sitecore 10 SIF Installation Roadblocks

Sitecore_10_Installation_Roadblocks

Sitecore 10 was out a couple of months back. I installed it using SIF, hit a couple of roadblocks while installing and sharing the resolutions that helped resolve the issues.

If you haven’t installed Sitecore 10, here are some blogs that help you install.

Sitecore 10 using SIF: https://scorewow.wordpress.com/2020/08/05/install-sitecore-10-in-10-using-sif/

Sitecore 10 using SIA: https://madhuanbalagan.com/installing-sitecore-10-using-sia

 

Error # 1: Solr Port Issue

I have multiple Solr services running for different versions of Sitecore and here is the error I got while installing Sitecore 10.

“Port 8984 is already being used by another process. Please choose a different port”.

Run services.msc to check how many Solr’s are running on the machine.

Resolution:

If you have multiple instances of Solr running and you don’t know what port, it’s associated with. Here is a quick way to get the process name and kill if it’s is no longer needed.

Find which process using Solr port

 

Get-Process -Id (Get-NetTCPConnection -LocalPort $portNumber).OwningProcess

Sitecore_10_Installation_Find-_Which_Process_Using_Solr_Port

Also when installing the Solr, you can add the Port Name and Sitecore Version number or any information in the Description of Details tab.

This is life saver, do not need to worry about which Solr maps which port in the future!

 

Sitecore_10_Installation_NSSM_Service

 

Sitecore_10_Installation_Service_List

 

Error # 2: SQL User Issue

“msdeploy.exe : Error: .Net SqlClient Data Provider: Msg 12809, Level 16, State 1, Line 5 You must remove all users with password before setting the containment property to NONE.                                                            At C:\ProgramFiles\WindowsPowerShell\Modules\SitecoreInstallFramework\2.2.0\Public\Tasks\Invoke-CommandTask.ps1:31 char:13”  

                                                    

Resolution:

For some reason, the SC10 uninstall did not remove all the variables for failed instances. I removed the  ‘sc10_CollectionUser’ in local DB users, fixed the issue.

 

Sitecore_10_Installation_SQL_User_Issue_Resolution

 

 

Error # 3: Credential Issue

Sitecore_10_Installation_Error_Credential_Issue

“Install-SitecoreConfiguration: A parameter cannot be found that matches parameter name ‘Credential’. This error might have been caused by applying the default parameter binding. You can disable the default parameter binding in

$PSDefaultParameterValues by setting $PSDefaultParameterValues[“Disabled”] to be $true, and then trying again. The following default parameters were successfully bound for this cmdlet when the error occurred: -Debug -WarningAction

-Verbose -InformationAction -ErrorAction

At C:\ResourceFiles\XP0-SingleDeveloper.ps1:77 char:1

+ Install-SitecoreConfiguration @singleDeveloperParams *>&1 | Tee-Objec …

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException

+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration”

 

Resolution:

The SqlServer module wasn’t installed by default, so I had to do it manually.

Ran this on Powershell command fixed the issue.

Install-Module -Name SqlServer -AllowClobber

 

Hope this helps someone. Any issues, let me know in the comments section.

Happy Sitecoring!

1

Install Sitecore 9.3 (using SIA) quickly in 20 minutes!

I’m participating in Sitecore Hackathon 2020 for the second time. One of the requirement is to have sitecore 9.3 installed on your machine except for commerce . I want to share my experience how i quickly installed Sitecore 9.3 using SIA(Sitecore Install Assistant) in 20 minutes!

Note: No need install any prerequisites(includes Solr) manually, SIA will take care of it.

Preparation:

  • Download installation package (Graphical setup package XP Single) from here.

Installation:

  • Extract the file zip file downloaded and click on Setup.exe
  • Install the prerequisites if needed. 
  • Install Solr 811 by filling Port, Windows service path prefix and Install path and Install.

Note: Make sure the port number is different from earlier versions of Solr installed. 

  • Fill out site prefix, admin password(going with b, so easy to remember) and license file path.
  • Fill out SQL server instance name, admin username and password.
  • Fill out the Solr URL, System root and Windows service name

Note: Go to Solr URL to make sure it’s running successfully.

  • Select optional module SXA if you need. I’m going for it, time to explore SXA! Would be nice if Horizon is listed here. 
  • Review the summary to make sure the settings are correct.
  • SIA validates to make sure the files look good.
  • Install. This takes around 10 minutes (you can get a coffee!). If it errors out, check out the log.

Yayy!! It’s installed. Is it easy to install with SIA? It’s indeed a great tool!

Check out the release notes for what’s new in Sitecore 9.3 here

Happy Sitecoring!

0

Install Sitecore 9.1 quickly in 5 easy steps

Image result for install software

I’m participating in Sitecore Hackathon for the first time this year. One of the requirement is to have sitecore 9.1(Initial version) installed on your machine. So I want to share my experience how i quickly installed Sitecore 9.1 using SIF on developer machine in 5 easy steps. This post includes the prerequisites, preparation and installation.

Prerequisites:

  • OS: Windows 10, Windows Server 2016
  • DB:
    • Microsoft SQL Server 2017 or 2016 SP2 – Supports the XM database and is the required for the xDB
    • Microsoft SQL Server 2014 Sp2 – Only supports XM databases and does not support the xDB
    • MongoDB Server 3.6.6 – This is required if you are going to use MongoDB for the Collection database or as a Session State Provider
  • IIS 10
  • . NET
    • Sitecore XP 9.1.0 requires .NET Framework 4.7.1
    • Sitecore Identity server requires .NET Core Runtime 2.1.3
    • You must apply any available updates to the .NET Framework on every Sitecore installation
  • Search Indexing
    • Solr 7.2.1 – Default search provider
    • Azure Search – supported and recommended for Azure Cloud PaaS deployments only
    • Lucene – Only supports content search and does not support xConnect.
  • Powershell 5.1 – for Installing SIF

Preparation:

  • Download installation package(XP Single) from here
  • Extract the zip file you just downloaded
  • Again extract this file – XP0 Configuration files 9.1.0 rev. 001564.zip
  • Copy your license.xml file (If you have enrolled for Hackathon, you should have received the file in email)

Now let’s begin the installation!

Step 1: Solr 7.2.1 Install

Check out Jeremy Davis’s low effort Solr installs. It’s pretty cool! https://jermdavis.wordpress.com/2017/10/30/low-effort-solr-installs/

If you want to take traditional approach(Install as service using NSSM tool), here are the steps

  • Download Solr from here
  • Install as service using NSSM tool

  • It opens the NSSM Service Installer like below. Fill out the fields.
  • Note: If you already another version of solr running, make sure to give different port name.
Solr 5 running as a service on Microsoft Windows

Step 2: Install SIF

Run the following scripts in Powershell as administrator.

Register-PSRepository -Name SitecoreGallery -SourceLocation https://sitecore.myget.org/F/sc-powershell/api/v2;
Install-Module SitecoreInstallFramework;
Install-Module SitecoreFundamentals;
Update-Module SitecoreInstallFramework;
Update-Module SitecoreFundamentals;
Import-Module SitecoreFundamentals -Force;
Import-Module SitecoreInstallFramework -Force;

Step 3: Update config files

Update the following files in the folder with the exact information – solr path, solr service name, configsets path, instance name for sitecore, SQL instance name and login credentials.

  • XP0-SingleDeveloper.ps1
  • XP0-SingleDeveloper.json
  • xconnect-solr.json
  • sitecore-solr.json

Step 4: Install prerequisites

Install-SitecoreConfiguration -Path .\Prerequisites.json

Step 5: Install Sitecore 9.1

  • Execute the script ./XP0-SingleDeveloper.ps1 (takes good amount of time to execute)
  • Fingers crossed!

Note: There is no ‘b’ admin password. You can get the password at the end of the script execution. Nice work Sitecore!

Notice that it installed the third site in IIS – Identity Server (New to 9.1)

Also noticed the http://[sitename]/sitecore/login now redictes to identiyserver in the URL.

Have fun exploring Sitecore 9.1!

Any questions, please leave a comment.

0