Smart Search Results: Search Condition question

Michael D asked on December 6, 2019 19:38

Hi,

Can someone please explain what this line of code means in the Smart Search Results web part from the Search Condition field: classname: "cms.menuitem"^0.7

We have User pages on the site and they were showing up in our search (the page type is included in the Indexed content of the Smart Search app). But they have since disappeared and I found this line in the Search Condition and when I remove it, the User page type shows up again in the search results. Also, I thought you have to use +- at the beginning of a condition but this doesn't have one. What does that mean?

2 more side questions please:

  • I see this there as well; what does it mean? -nodelinkednodeid:[0 TO 9]
  • I assume the answer is There is more than 1 way to skin a cat, but if someone wanted to remove the page type User from search, why do it from the Search Condition rather than remove it from the Indexed content of the Smart Search App. (my guess is that they didn't want to rebuild or recrawl the site and that's one way around it. it just seem wrong to say Add it and then say Exclude it.)

I know this is a lot so MANY THANKS!

Correct Answer

Juraj Ondrus answered on December 6, 2019 20:57

You can find the answers in the smart search syntax documentation.
- The classname: "cms.menuitem"^0.7 means that the page type of the result item is boosted.
- nodelinkednodeid:[0 TO 9] - this one is excluding the linked pages and the correct syntax should be like described here.
- The + symbol indicates that only results which fulfill the field condition should be returned. The - symbol has the opposite meaning, only results that do not contain the specified value in the given field are retrieved. So, in your case only result items of given page type are returned.

And yes, you are probably correct. Or, this can be used if you want to use one index and have different search pages - in one you want to include that items in the results and on other you do not want them. This can be also solved by using separate indexes. In both cases you have multiple things to maintain and I would say that in this case setting this on the web part level instead of index splitting is the less effort thing.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Duncan Koza answered on January 31, 2020 22:42

In the Search condition field, can I set multiple conditions.... lets say 4 of them?

Example: Don't show linked pages, boost pagetype1 by so much, boost pagetype2 by so much, and don't show a specific page type.

-NodeLinkedNodeID:[0 TO 999999999]

classname:"custom.sjcg_MainSection"^0.2

classname:"custom.sjcg_StandardPage"^0.3

-classname:"custom.sjcg_FileFolder"

How do I write it out? I tried this but it didn't work: -NodeLinkedNodeID:[0 TO 999999999];classname:"custom.sjcg_MainSection"^0.2;classname:"custom.sjcg_StandardPage"^0.3;-classname:"custom.sjcg_FileFolder"

Thanks for any help you can provide.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on February 3, 2020 08:06

Try it without the semicolons, just write the condition as it is, leave a space between the conditions.

0 votesVote for this answer Mark as a Correct answer

Duncan Koza answered on February 3, 2020 17:31

Perfect! That worked, Thanks.

0 votesVote for this answer Mark as a Correct answer

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