Exclude Kentico Linked Documents from Smart Search Results

It’s pretty easy. Simply go into the Smart Search Results Web Part and set the Search condition to:

-NodeLinkedNodeID:[0 TO 999999999]

Image:

Kentico Smart Search Results Web Part Settings Dialog

Another quick tip is to exclude disabled products from your search results if you’re using E-commerce:

-NodeLinkedNodeID:[0 TO 999999999] AND SKUEnabled:true

That’s it!

Explanation

If you’re wondering what that funky syntax is, it’s Lucene Query Parser Syntax (technically Lucene.net, but I think the same syntax applies). It basically says:

  • ”-“ - Exclude…
  • “NodeLinkedNodeID” - Documents (Nodes) where the NodeLinkedNodeID is…
  • ”:[0 TO 999999999]” - Between 0 and 999999999.

So if the NodeLinkedNodeID field has a number in it, it’s a Linked Document and we want to exclude it.

Credit

I originally found this solution on the Kentico DevNet, posted by Juraj Ondrus, but I figured it would be good to have a stand alone post along with a deeper explanation of the solution.

Published: August 01, 2014

blog comments powered by Disqus