Smart Search - search only for specific page type - search condition?

Tomasz Sikora asked on September 4, 2017 15:39

I've alredy figured out that I need to use SearchCondition property like this:

SearchResults.SearchCondition = $"+documenttags:{tag}";

To be able to add custom condition to smart search (CMSModules_SmartSearch_Controls_SearchResults) to display pages with tag given in "tag" variable.

But how can I create a condition that will search only for pages with specific Page Type?

Recent Answers


Chetan Sharma answered on September 4, 2017 16:39

Since you are using .NET code you can send one more property in your SearchParameters object

SearchParameters parameters = new SearchParameters() {
  SearchFor = '+classname:[CMS.Faq;CMS.Blahhh]' //Semi-colon separated listed of class names
}

Try this.

Thanks, Chetan

3 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on September 5, 2017 01:19

I normally use nodeclassid: nodeclassid:(int)123

You can check cms_class table and find your class (pagetype) and use id from there. I think you can also use classname: classname: "classname"

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.