Sitecore Commerce: Elasticsearch driven Faceted Search/Navigation for eCommerce – Part 2

In Part 1 of this series we described the faceted search/navigation search pattern with an example from the northface.com website. We also installed Elasticsearch and Kibana. In this post we’ll be setting up the index, define the data structure, create a mapping document, load some sample data and construct a query for faceted search/navigation.

Creating the Index
To store and index data in elasticsearch we first need to create an index. The index can have specific settings associated with it and can be defined in the body of the request. We will set the number_of_shards and number_of_replicas to 1 for simplicity and to avoid an issue where the result item scores can be incorrect with multiple shards and very small dataset.

Query:

1
2
3
4
5
6
7
8
9
PUT productitems
{
"settings": {
"index":{
"number_of_shards": 1,
"number_of_replicas": 1
}
}
}

Response:

1
2
3
4
5
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "productitems"
}

Defining the data structure
We have a concept of the Product which describes the product being sold. It has a Product Id, Name, Description, Image, Specifications, etc. The product may come in different variations, for example color or sizes in case of clothing products. A variation is represented by Variant entity. A Variant is what is actually inventoried, sold, and shipped when a customer purchases a product. It has a SKU, Price, Stock, Variant Image and other Variant specific attributes (color, size, etc.) associated with it. In our NorthFace.com example from Part 1, we performed a faceted search for Red and Orange Jackets and the results came back with the images showing the appropriate colors. To be able to achieve this we need to index the Variants instead of the Products. Doing this brings up a problem though. Now if you searched for Jacket without the color facet selected you will get all Variants for a Product showing up in the results. This is not an ideal experience but thankfully there is a way to fix it which I’ll describe shortly.

The following Product->Variants structure represents a Color-Size attribute combination typical of a clothing product.

Product: Men’s Venture 2 Jacket

  • Variant: Red-Small
  • Variant: Red-Medium
  • Variant: Red-Large
  • Variant: Blue-Small
  • Variant: Blue-Medium
  • Variant: Blue-Large
  • Variant: Yellow-Small
  • Variant: Yellow-Medium
  • Variant: Yellow-Large

A JSON representation of such a hierarchy would look something like this:

SSRS – The Application is not installed message in Visual Studio 2015

Every once in a while I get to dabble with SSRS. This time I needed to edit some SSRS reports in an SSRS project that a co-worker had added to our Visual Studio solution. When I opened the solution the SSRS project failed to load with the message “{ProjectName} Incompatible” “The application is not installed”.
TLDR: You need to install SQL Server Data Tools Preview in Visual Studio 2015 from here.

ssrs-project-application-not-installed-visual-studio-2015-error

Apparently, I needed to install the Microsoft SQL Server Data Tools – Business Intelligence for Visual Studio from here.

I ended up downloading the iso which is 171 MB. Running the SSDTSETUP.exe ran the installer and finished without any issues.
microsoft-sql-data-tools-2015

Reopening Visual Studio did not fix it :-(. I was still getting the same “The application is not installed project”. It turns out that the latest version of SQL Server Data Tools for Visual Studio 2015 does not have the BI template for visual studio and we will need to install the previous version of it from here.

Update:I tried the Microsoft SQL Server Data Tool – Business Intelligence for Visual Studio 2013 from here.
Still getting the same issue. FYI, there is no separate x64 version of the SSDT installer. You may get an error that says “Rule evaluation message: The CPU architecture of installing feature(s) is different than the instance specified. To continue, add features to this instance with the same architecture.”. You need to install SSDT-BI as a new instance instead of adding features to an existing instance. The error message is completely wrong but luckily we only do this kind of stuff rarely.

SSDT-2013-New-Installation

Still no luck. I am going to try the preview version of the SSDT Visual Studio 2015 tool.s

Update: Trying SQL Server Data Tools Preview in Visual Studio 2015 from here.

SQL-Server-Data-Tools-Preview-Visual-Studio-2015

I needed to restart after the installation completed and voila it worked.