My dear colleague Steve McGill pointed something out to me I never noticed before. However after noticing it I could not help but be extremely bothered about it.
A true case of:
(I might or might not be exaggerating just a tad here)
In any case, I’m talking about the search facets when searching for bucketable content in the Sitecore Content Editor:
So far so good. Lets select a couple of facets.
It’s still not too bad – but now imagine if we’ve have multiple custom facets selected – especially booleans. The facet, when selected, would just say ‘0’ or ‘1’ – but we don’t know which facet this would be.
This is definitely less useful… So how can we make this more useful? The file that we’d be interested in changing here is webroot/sitecore/shell/Applications/Buckets/Scripts/ItemBucket.js.
Which we can change to (I’ve added the bold for emphasis):
‘this.value’ is simply the field name Sitecore facets on. I added ‘.split’ as well because it passes the value in there as well (so for English language facet it would pass ‘culture|en’).
This isn’t flawless either, since the ‘Author’ facet is using the ‘parsedcreatedby’ field in the index. If we wanted to change anything there we’d have to change the AppendFacet method in the same file to take in the display name of the facet as well (rather than the field).
One big consideration to keep in mind here is that we’re overriding a Sitecore file, which of course might change with future updates in Sitecore, so use with caution.