Published on

Sitefinity Taxa Filtering hardcoded to only use AND

Authors

Sitefinity has one major bug in it’s implementation of taxa filtering seem here: View Link

It basically assumes you always want an “AND” between taxonomies you have no ability to do an “OR”; this is a massive assumption. Let me give you an example of why this is a problem:

“Show me all people tagged with brown hair OR categoriezed with red sunglasses”

Sitefinity would interpret those taxa selections as

“Show me all people tagged with brown hair AND categoriezed with red sunglasses”

It would be easily solved if they exposed a new property on the root model and just referenced it there like this

…or something to that effect, it can be an advanced designer model property.

I’ve been yelling at a wall over this for years and nobody over there seems to see why it’s an issue, so I thought I’d share our workaround (which is terrible for content editors who dont know C#\json\html whatever btw).

  1. Don’t select any taxa in your designer, set it to all items in the content tab
  2. Click Advanced->Model
  3. In the FilterExpression box type in your required filters per the filterexpression documentation

The caveat is of course that you need to filter the taxa by IDs, and where the heck do you find those you might say… well… we can easily expose them to showup in the backend taxa lists like on tags here: /Sitefinity/Content/Flat

Here’s how you do that (see images below):

  1. Open Advanced settings
  2. Drill down to the appropriate taxa content view (flat or hierarchical)
  3. Find the grid view, click create new DataColumnElement

TaxaListAddId

And here’s what she looks like when you refresh the Tags grid

TaxaListResult

Now you or your users can just copy\paste the Ids into custom filter expressions which will confuse you at a later date when you open the widget to see no taxa selected in the UI.

…or ignore all this and write a complex custom widget to do the same thing

** PLEASE TELERIK, QUICK PATCH THIS GUY IN! **

Boost your online presence.

Let us create the perfect digital experience for your company.

Contact us now