Coveo for sitecore get started step by step part-2 (Installing a package)

July 04, 2021 ·

Coveo for sitecore get started step by step part-2 (Installing a package)

 Hello Folks,

As promised, Today i will be showing you what are the initial first steps towards getting up and running with Coveo for Sitecore.

In my previous blog post PART-1  i have given some basic understandings of few things of Coveo for Sitecore, if you have not checked them, check them out by clicking the link given above.

So very first thing that you need is to install a package of Coveo for Sitecore from the Coveo official website, Here is a end point from where you can download the package for your preferred Sitecore version.

Coveo for Sitecore Release & Download It is worth checking for supported sitecore version and dependencies

Let's start

1) Ok, because i have set up one instance of Sitecore 10.1 on my machine, i will download corresponding package from the URL above, you can see my version in the below screenshot 


so i will be downloading package for 10.1 and hence see below screenshot, i will be first installing Coveo for Sitecore package 10.1 and after that i will install SXA module package, Because to install SXA module for Coveo Sitecore, you first need Coveo for Sitecore package installed on the instance

2) now i have installed the package and i will be installing it from Sitecore install package wizard like below 


as you can see the package is the compatible package that i downloaded for my Sitecore version, now we just need to go and install it and in the last final step, it will ask us to connect with our organization, i have mentioned about what is organization and what is the purpose of it in my "PART-1"

3) Once you finish installing at the last step, it will ask you to activate the Coveo for Sitecore package by signing into to the organization

On clicking "ACTIVATE COVEO FOR SITECORE PACKAGE" button, it will take you to the login screen from where you can login into your coveo organization 

4) I already have my test organization set up using my office365 login, but there are different options too, go ahead and create the organization or select the existing organization like below, because i logged in with my already associated organization for which coveo license was already purchased so it gave me selection of which organization i want to select from which are already activated for using Coveo for Sitecore 


Select how you want to index things, i have selected "Only Index Sitecore item data", but you can also index rendered HTML too, but as we are building a search page which needs to read and indexSitecore items, i have selected second option

Also as described in my previous article about organizations and farm name etc, here also Coveo will ask to provide a "Farm name", what is farm name and what is the use of it is i have given information on my "PART-1"

5) For this demo, i will give farm name as "D-Demo-Farm" and i have provided my current Sitecore instance admin user name and password, once done click "Activate"


6) So, after above step, once your coveo is activated for your organization against your current Sitecore instance, and you will be able to see the default coveo_master_index and coveo_web_index on the coveo dashboard, because we have not indexed anything yet it has no documents yet

So far so good, we have now installed Coveo for Sitecore in our Sitecore instance and we can now index our content so we can start creating our search page from it

7) But before we do that, we will need to install another package for all coveo components so we can utilize those components to create our page, now as coveo for sitecore is set up in our local, we can go ahead and install "Coveo for Siecore SXA components" package from the same URL i mentioned above


NOTE: Perquisites before installing this is, We should have Coveo for Sitecore installed (which we already did) , and SXA should be installed on the Sitecore version too

8) After successfully installation of these two packages, let's verify that all Coveo HIVE templates are available in our template section, so we can create components and data source from it for our search page


9) As we can see templates are available, now before creating a search page we will need to create and location where all coveo data source and its components will reside, we will do that in our site settings area, we will need to right click our settings and select "Insert from template option" and create a folder all coveo for sitecore components like below


10) now, we will need to select a template from which we can create a folder where coveo components can reside, select "/sitecore/templates/Coveo Hive/Structure/Global Folders/Global Parameters Folder" in template path and give item name as "Demo Coveo", once done it will create the container folder and which will have all insert options available to start creating coveo component data sources which will be needed to be configured for coveo search page.

Phew !!! i think it is lot of information at once, so let's take a pause here and in next article i will show you how we can start creating a search page and start configuring the components on that page, we will need to do some house keeping, indexing of items, create some items and populate them with data and index them etc.

I hope so far this series is adding some value in implementing Coveo for Sitecore.

Tips & Tricks

Because our purpose is to understand basics hence we are going step by step, but, do you know? Coveo provides example page branch templates from which we can create page item and it will by default create all the needed items for us, we just need indexed data and some configuration and it a search page will be up and running, See below how i have create one sample page "Example Page" by selecting "Example Template", like below 


So above is the template you will select from "Insert from template" option on a home item and once done, you will see all coveo component data source and parent folder items will get created automatically, like following


 

Cool, haan? We will utilize this fast approach and create our custom search page from it

 See you in the next article !!!






Coveo for sitecore get started step by step part-1

June 27, 2021 ·

Coveo for sitecore get started step by step part-1

 Hello Folks,

Today i will be sharing few essential pointers about coveo for sitecore, such a powerful tool for creating search interface and search pages for our websites

I will write this and keep content in such a way so anyone who is new to coveo can get started with the search page and coveo components


 

This is part-1 of this series for coveo for sitecore, so first i will try giving some basics of coveo and why few things are required and must to have or what is needed to get started, what is essentials and mandatory actions for getting up and running with coveo search page.

Ok, so let's get started, Well when i implemented my first search page, before that, i had so many questions about coveo and how things are working, if we have solr why we need a coveo again which also has its own master and web indexes (silly questions but when you are starting, no question is silly), How to install coveo and what are the things needed, existing indexes which we have used, do we need to change them? or how coveo will know about those indexes and code reading from those indexes etc.

Because i had no knowledge of coveo, i had these questions, but i started researching and learning coveo to understand more and i started getting more clarity around things, If you also have these questions, i will try to answer them here

What is coveo for sitecore

Well this documentation is already available on What is coveo for sitecore you can read details there, but in a nutshell, coveo for sitecore is a package just like any other sitecore package that you install, so once you install the package from Coveo for sitecore packages , Make sure to see the compatibility of your  sitecore or SXA version against coveo provided packages from various versions available

Basically, "It's a package that you download and start using coveo search components"

So, First set of queries that i had were answered here, where when you are trying to start something you need that first step, and this is the first step in implementing coveo for sitecore, when you download the coveo package is installed, It comes with its own indexes coveo_master_index and coveo_web_index.

Also, coveo is capable of and has full support of greatest and latest version of sitecore.

in this series and in my following blogs, I will show step by step from installation of package till getting up and running with search and its different components and how customization can be done depending on different needs.

But before getting our hands dirty, its good to have a basics clear, we just have learnt what is coveo, now once coveo is installed, there are lot of terminologies and lot of mandatory steps which are must in order to have successful coveo search running, Let's get those points clear and after that we can gear towards actual implementation steps.

What is mandatory if you are implementing coveo for sitecore

1) Coveo organization & coveo license

A Coveo organization is a single tenant instance hosting data and Coveo Platform service configurations allowing an organization to make content sources securely searchable with optimized relevance powered by Coveo Usage Analytics and Coveo Machine Learning. 

When you install coveo package it will ask you to select your organization, if your organization has already acquired the license, you can login with your organization's email and it will automatically identify you.

If you want to try out the product, there is 30 days trial available with full fledged functionality of coveo

So, either existing custom or a new, basically your coveo organization hold following things for you

  • A set of search sources 
  • Analytics data
  • Query pipelines  

All the data that we index from different sources (coveo is capable of indexing data from sitecore and also external resources too) in your organization's indexes.

After the deployment of Coveo for Sitecore files in your Sitecore instance, you need to configure your indexing options, setup a connection to your Coveo organization and activate Coveo for Sitecore

There are three different ways you can connect and activate your organization, If you already have coveo integrated into your site and if you are creating another search page, You do not need to do this, because it must have been done already, but if you are starting fresh, you need to activate your organization using following three ways (most of the time, it is done just while installing the package when it prompts for organization's data and connect to it, we will see it it coming blogs)

  • Using sitecore interface

When installing Coveo for Sitecore as a Sitecore package using the Installation Wizard, Coveo for Sitecore will automatically prompt you to configure and activate

Alternatively, If you by mistake skipped activating your organization at package installation time, you can go to predefined URL and do it from there too,  See Activate coveo organization

  • Using Rest API 

In scaled environment there might be some scneario where you want to activate the organization behind the scheme using automated process, in that case APIs can be used

  • Using Powershell script

2)  Coveo Farm

Well, It is is not mandatory to have a farm name, but farm name is a part of the above step where, while setting up organization's detail, it also asks for farm name, its not mandatory but its a good way to unify all your coveo resources under one label or name, for instance all of your developers can have same farm name, your dev, qa, stage , production can have their respective farm name to have all of their respective search resources unified under same umbrella.

If you do not provide farm name, it takes Sitecore host and instance name instead.

Why personally i think farm name should be given is because, while making custom api calls, you can easily target coveo indexes from particular farm, We will see that in a future blog post.

3) A well built search indexes

Just like a standard solr indexes which ships with sitecore, coveo has its own index, and before you get started with any of the component set up, you will need to have data in index, and you can also configure the content tree path to tell coveo what content you want to index, but when you are installing coveo for the first time, your indexes will be empty, you can run indexing via coveo admin panel to index them and those indexes will be populated with data in your configured farm.

4) Coveo Search Resources component

Coveo Search Resources is a mandatory rendering in any Coveo for Sitecore search interface, whether for a complete search page or a part containing any coveo search functionality

Why this rendering is required on the layout or a page is because, all other coveo search infrastructure will need information generated by this rendering.

This rendering adds JavaScript and CSS references required to use the Coveo JavaScript Search Framework renderings and the Coveo for Sitecore-specific renderings.

When you are starting with any new technologies at that time you do not have all the information, or you have too much information and i personally feel, in those cases it is very hard to get into the judgement or fundamentals of it as either its too much to research or there are too many questions around it

So although coveo for sitecore is very well documented, purpose here is to accumulate few things which are a good starting point for a developer instead of a detail research and going through too many documentations.

So in next article i will explain components that ships with coveo and their usage and will gets our hands dirty.

Hope you will find these information helpful as these are derived from when i first hands on to coveo and extracted the crux out of it and putting it here.

Thanks. 


 

 

Sitecore SXA creative exchange export appends hyphen(-) number to the static assets

May 20, 2021 ·

Sitecore SXA creative exchange export appends hyphen(-) number to the static assets

Hello There,

So, today i will be sharing some information which i think will be useful for many as this might come as a blocker just like me, where i was planning for a next sprint for which i was checking prerequisites and suddenly found out that, Export functionality of SXA is not working properly, it was exporting things but i open the page which was exported (index.html), it was loading without any CSS or JS functioning.

Problem

I have been using SXA but i never had this issue before, where page or site gets exported but when we open the page, it comes up without CSS or JS functioning properly on the page.

So, first thing like any developer i opened up the source of the HTML and tried to see why CSS is not working properly and checked its path and found out following 

I was surprised at first point as i never saw this behavior, but one thing was confirmed that, SXA is adding these "-number" at the end of CSS when we export so, i tried to de-assemble the DLL just to see what is the logic behind doing this

One thing here is if i remove these "-number" manually from the html and save, the page was just working fine, so we only needed to find what is that thing doing it

Solution

If you want to see the functionality inside what is happening behind the scene for creative exchange, you can open the dll "Sitecore.XA.Feature.CreativeExchange.dll" in any of your favorite de-assembler and see different things it is doing

But for me, i was interested in the link generation part where it appends the incremental number, so following is the place from where it does that, There is a class called "LinkProcessor" in that DLL


So here if you observe, it is trying to look for "?" meaning if any query string is there it will try to add that unique number and append it, well so this was clear to me that my css link tags should not have any query string to it, and i quickly browse one of my pages and saw that our CSS were having revision number attached to it, see following 


 so now i was convinced that because of this ?revision only OOTB export code is attaching that number, but my surprise was the setting which tells sitecore weather to append revision or not on media items was FALSE for me, below is a screenshot of my showconfig.aspx 

So generally appending of revision query string to media assets is govern by this setting, but its false already, if it was true then it was understandable that revision is being attached from this setting

Now i focused my research around what else can cause this issue, where it just clicked that we are using Azure akmai CDN, though CDN is disabled in local due no end point configured but we still have its config etc, so i just opened up its config and i found that there is patch

and this patch was the culprit as it is forcefully appending the revision query string to media items, see below code 


So now i was convinced about what is going wrong here, so what i decided is to disable the Azure Akmai config because that is the one patching this code, so in local development environment i decided to disable that config 

and everything started working just fine, no "-number" attached while exporting, but now we also had enough understanding of how creative exchange is doing things inside for generating that links

So take away here is, if creative exchange generates those kind of URL for you, things to check are 

1)  Check the flag "Media.AlwaysAppendRevision" setting is set to "false", else it will append revision and export will append those unwanted "-number" to URL

2) Check if there is nothing which is appending those revision or versions (sometimes to refresh css or JS developer appends version to the end of it), else SXA will generate those number at the end of it

Thanks, i hope this will help someone having same issues


 


Sitecore SXA IsLink (Magic) and Open links in a new tab for OOTB navigation component

May 18, 2021 ·

Sitecore SXA IsLink (Magic) and Open links in a new tab for OOTB navigation component

 Hello People,

I hope you all are doing just well in this pandemic time and staying home and working from home, Today i will just have a very quick post to demonstrate some of the flexibility of SXA 

Requirement

Well, we had very simple requirement where we used OOTB navigation component, and everything worked just fine but we wanted to have all those link open in a new tab, So we started looking at what HTML this navigation component is returning, So we can just create a clone and have our custom links generated, but it did not help as existing component just renders the variant so structure must have been defined in variant 

Solution

So next check was for variant structure and i observe that there are no link ("anchor" tag defined), but the beauty of SXA is there is a field call "Is Link" which converts your text field into anchor while rendering, see below 


1) Here if you see "Is link" is the one responsible for converting any field of a variant to an anchor (quite cool and handy)

2) And second solution to the problem is because its creating a link internally we needed a way to add target="_blank" to all anchors generated in navigation and if you see "Link attributes" fields, over there you can specify those custom attributes to get those rendered when links are generated

Now all menu links of OOTB navigation component will open in a new window 

I think very helpful and quick solution, Powerful SXA !!!

See you in the next post.

ERROR: DoCommand Failed:Invalid or missing value for property 'Domain'

March 14, 2021 ·

ERROR: DoCommand Failed:Invalid or missing value for property 'Domain'

 Hello Folks,

Its Sunday evening and i am in my balcony planning to publish few blogs (which are in my drafts from long time) before this Sunday is over :) So today i wanted to share quick info on one of the issue we were running into while creating a user on commerce side 

Scenario

So, Here is a thing, we were implementing custom domains for our client for their multi site tenant setup, so they have one instance for US, one for Canada likewise and they wanted a user creation to be in that domain 

Now our storefronts already had proper domain mapped on sitecore side like following 

  

But as soon as we were trying to create a user from storefront using OOTB registration component, it was giving below exception 

972 01:47:16 ERROR DoCommand Failed:Invalid or missing value for property 'Domain'.

972 01:47:16 INFO  AUDIT (DemoUS\Anonymous): Add user to role: DemoUS\Extranet User, user: DemoUS\test1@test.com

972 01:47:16 ERROR Invalid or missing value for property 'Domain'.

972 01:47:16 ERROR User created but external Id was not provided.

 

Now looking at the exception it was time to look into commerce side as we have seen before that while creating a customer it needs a domain, now because for a custom domain, existing OOTB json files of domains will not have that domain and because of that, from sitecore when code run it tries to find that domain which is used while creating a user and it is not able to find it, so simple solution to this is to add that domain to existing list of domains which are available in commerce.

 

Solution

Now on authoring environment you will find different environment configuration file, in our case we already had our custom environment bootstrapped, so it was referring to our custom environment files, Click Here to read how to create custom environments

 

So What is needed is to open respective environment files json files and add our specific domains there, like below 


1) Go to \CommerceAuthoring_local.ce\wwwroot\data\Environments on your respective roles (i am taking example of authoring here)

2) Find "domain" in the file and add your custom domain, like following 

 

 

3) Now make sure to run bootstrap to allow changes to be applied and now make sure that you are able to see this domain on customer object while you are creating a customer on commerce side like following 

 

 

 

 

And you should be good to go, next time you create a user it should also create a customer too with that custom domain :) 

 

TIP: This is only applicable if you are using SXA and commerce flow, if you are using commerce in headless environment, you will get the same exception but solution is totally different for that, Read Here the solution written by one of my colleague "Aakash Savalagi" for it 

 

Happy Sunday and good night.