Friday, May 15, 2020

Using Bucket Search to find empty field values

The bucket search interface is an under used feature in Content Editor, at least underutilized by me.  One of the things that's always thrown me off is the OR vs. AND syntax.  I'm currently doing some discovery using the Helix.Examples site, and I need to clear the related product values.  I thought it would be helpful to be able to see the ones I've already cleared, or the ones that I still have left to do.  (There's just 20, or else I would have installed Sitecore PowerShell Extensions to do this.)

So far, I've cleared the Related Products field on 5 of the 20 Product Detail Page items.  Let's see this in the bucket query:

Okay, let's restrict to my bucketed type, to avoid the Shared Content and the Bucket folders (like "2019"). Type "tem" and tab out the autocomplete to "template"


A weird bit of UI glitchiness is you will just see "Template" (at least it's capitalized now), until you type a colon (:), then you get a little selector field with autocomplete. Select your template type:
 And we get 20 results as expected.


Okay, now let's add the filter by field value. Type a "c" and tab out to "custom", then type a colon to get the field selector:







Now type "r" and select "related products" which brings up this:





Type an asterisk after the pipe symbol to select any non-empty value:



Why did we get 20 results if 5 items have been cleared? The field is not empty condition is getting treated as an "OR" condition, so the template condition is causing the undesired fields values to be included.  By clicking on the magnifying glass icon next to "Related Products", we can make that an AND condition, and now we get 15. Nice!


Click it again to make it a NOT condition, and now we have only those items with that field empty, and now we get 5.




And you can see in your Search log what is going to Solr. OR, AND and NOT syntax bits called out below:

That was a lot of screen shots for a pretty simple feature, but I've always found the autocomplete a little perplexing, especially the bit about having to type a colon to make the field selector logic appear, and needed to click the condition into AND mode.

Happy Sitecoring!

Sunday, August 25, 2019

Overview of the Commerce 9.1 SIF Installation Process

The Sitecore Commerce installation really puts SIF through its paces, and a number of things can go wrong along the way. Having a clear sense of what the script is doing, how it is structured, what the bumps are, and how to pick thing up after an error can make a big difference, so I thought I'd share my experiences. These notes are based on the Commerce 9.1 installation, though I touch on what has changed since 9.0. I hope to look at the recently released 9.2 installation process in a future post.

Monday, July 10, 2017

Using Powershell to find duplicate IDs in serialized items

On my current project I was troubleshooting a failing integration test that makes use of the Sitecore FakeDB Serialization module, which can declarative load a branch of content directly from the file system. The setup method for this test was reporting a duplicate key exception, so I used PowerShell to identify the culprit.

Saturday, April 22, 2017

Readable Tests

There's a great little chapter in Growing Object Oriented Software Guided by Tests on how to write helper methods for building complex test data. The specific techniques are somewhat less relevant in a post AutoFixture world, but the chapter also makes a powerful case that test code should read as English prose.

Monday, January 2, 2017

First steps with SpecFlow and Selenium

I've always been a Unit Testing guy, but reading Growing Object Oriented Software Guided by Tests really brought home the role an acceptance test outer structure can play in an iterative development process.

Wednesday, November 9, 2016

Zapping Solr Cores with Powershell

Imagine you've been working on a feature that creates Sitecore Solr indexes with SIM. Three's a lot of testing that goes into that.

Wednesday, November 2, 2016

Disposing of a DLL

So I've been working on a feature for Sitecore Instance Manager to automate installing Sitecore instances with Solr turned on.  This has been pulled in to the Develop branch of SIM and should hopefully hit the downloadable version soon.

Wednesday, October 26, 2016

NCrunch

If you want to make unit testing and TDD truly addictive, you should look at NCrunch, which basically gives you while-you-type intellisense for unit tests.

Thursday, September 15, 2016

Another Look at Sitecore and Unit Testing

At Sitecore Symposium 2016, I will be giving a talk on unit testing in Sitecore. The focus of this talk is on the notion of testability.

Tuesday, June 14, 2016

Debugging and Creating PDBs with ReSharper

Being able to debug Sitecore code is an important skill for supporting Sitecore solutions.  There have been a number of excellent articles on how to do this, but they typically describe using JetBrains DotPeek product as a "symbol server". (See http://bilyukov.com/debugging-sitecore-dotpeek/, and https://jammykam.wordpress.com/2015/01/11/how-to-debug-sitecore-kernel-in-visual/). An alternative, which I find somewhat simpler, is to use ReSharper to generate PDB files, and place those in your solution bin directory. I will walk you through that approach in this article.