4

I am working on a SharePoint enterprise server 2013. and I have created a term store and linked the wiki pages with the term store. now I am trying to define the following search rule:-

If there is a wiki page which is linked to a term, and this term have a shared property named "ShowInSearch" =false, to exclude the wiki pages from being displayed in the search result.

To achieve this I tried the following:-

1- I went to "site setting">>"Term store management".. Inside certain terms I added the following shared property :-

enter image description here

2-Then I went to "Central admin">>"managed service">>"search">>"result sources">>and I modify the default query inside the query builder, to exclude from the search any wiki page linked to a term and this term have "ShowInSearch" =false. I did so by adding the following rule to existing query {Term.ShowInSearch}<>"false" (as mentioned on this link link). here is how the full query looks like , after my modifications:-

{?{searchTerms} -ContentClass=urn:content-class:SPSPeople} {Term.ShowInSearch}<>"false"

Then I run a full scan, but the search will always show the following error:-

Nothing here matches your search

so can anyone advice on this, please ? how I can exclude from the search any wiki page linked to a term and this term contain a shared property named "ShowinSearh"=false ?? and why my above approach did work ?

2
+50

So to start, the custom properties in the termstore are not propagated to the search index. You can use them to modify your search based on the current term (say, passing the current term ID into search). You would probably be better off creating a field in your wiki library called "excludeFromSearch" and modify your query to target that field. Note that you would need to modify the field value of the item, rather than the term property, but that might be easier in the long run. You could even customize the wiki layout to show the field, and allow authors to control the setting.

  • but on this link technet.microsoft.com/en-us/library/jj683123.aspx it mentioned that i can access the Term custom properties inside the search is this correct ? second point , having a filed inside each wiki page (named "excludeFromSearch" ) is not what i am looking for .. i need a way for end users (term store managers) to be able to go to the term store chnage the value for the custom property from true to false.. to exclude the related wiki pages which are linked to these terms from the search... also if i am going to implement the field inside each wiki page.. – john Gu Aug 31 '16 at 12:18
  • .. then i think it will be easier to rely on the built-in SEO properties for each page ... which already provide the option to Exclude from Internet Search Engines ... so in all ways implementing my own "Excludefrom search" field is not the way to go.. is this valid ? – john Gu Aug 31 '16 at 12:20
  • 1
    The term that you are accessing the custom properties of is the term of the current page, not of the target of the search system. For example, if you were running a catalog based site, your navigation node (and thus the current term for the request) has properties. When you have term.foo in your search query, you are replacing that with property foo of the current term you are on. So Yes - you are better off using the existing SEO property. – PatMill_MSFT Aug 31 '16 at 16:49
  • sorry but i did not understand your latest reply correctly (term.foo....).. on the same side i do not want to use the built-in SEO properties because in this case i have to do this on each page,, while i want a more general appraoch to hide pages from search based on specific terms,, not based on specific page/s . – john Gu Sep 1 '16 at 12:15
  • Let me try a different approach. The substitution feature you are using {Term.ShowInSearch} as well as other substitutions work based on the context of the current page / request. In other words, the value that gets replaced at runtime is fetched from the current page, current user, current site, current term, etc. If you were to look at the search that is actually executed, those "slots" would be replaced. You are viewing them as managed properties that exist in the search index itself. When you use managed navigation, each page you hit has an associated term, and that is the value used. – PatMill_MSFT Sep 2 '16 at 20:07
0

What you are looking for is not possible. You can not search for (or exclude) items depending on a custom property from managed metadata.

(With the single exception, that if you're using managed navigation you can access the current navigation term)

  • @Nile this can be a limitation as you said , but inside the following link technet.microsoft.com/en-us/library/jj683123.aspx they specified that it is possible to access a property for a term inside the search using the following syntax {Term.<property>} ... so what they are talking about ? – john Gu Sep 5 '16 at 16:07
  • @johnG: The referenced article is talking about terms used for managed navigation ( technet.microsoft.com/en-us/library/dn194311.aspx ) - it is possible to a have a specific TermSet used for navigation purposes. In that case all (or at least some) pages in a web are based on a specific term from that termset. Only in theese special cases can you use the mentioned syntax - and only for the navigation-term that represents the current page. – Nils Sep 5 '16 at 16:18
  • ok i got your point ,, so if we return back to the original question,, which appraoch i can follow that allow me to include exclude pages from search based on their terms ? – john Gu Sep 7 '16 at 13:18
0

I have created a custom column property on my Pages list called IsSitePage, it is a bool check box. I have created a result source which queries the Pages list.

When creating the Search Results snippet, I click change query, select my result source and then select refiners tab. I scroll down to my IsSitePage property and choose no from the options beneath it. Clicking test query shows my search correctly refined by pages where IsSitePage is false.

Now add search result snippet to page and job is done. All this adds to page creation is the ticking of a box if the page is a site page.

Note, the IsSitePage column should have a managed property which is searchable, queryable and refinable for this to work.

  • while your are appraoch is valid,, but this is not what i am looking for. as per my requirements i do not want users to be editing each page separately, instead i want term store admins to modify the custom property of a term and change its value from true to false.. so after doing so all the pages which are linked to a term and this term has its custom property=false will be excluded from the search ..so your appraoch is implementing different scenario .. – john Gu Sep 5 '16 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.