1

I have a list with column who have managed data property and I would like that a user can search based on that managed data property. For example if I have this hierarchy in my Term Store

Countries

-->North America

---->Canada

---->USA

If user would enter North America it would search the list and give all result tagged as North America ,Canada and USA. That mean I want result set with Parent terms and all the child terms.

How can I achieve that?

I have used REST and its giving me only results tagged with child terms?

Do I need to make a web part ? Should I use CAML ?

I am lost.

TIA

  • Can you include your REST query?. – Rothrock Jun 23 '17 at 21:31
  • -filename:allitems.aspx IsDocument:True AND MyManagedDataColumn:\"North America\") AND (SPContentType:\"MycontentType\" – SP CON Jun 23 '17 at 21:37
0

While managed metadata is a potential way you can achieve this, based on your requirement that you are only needing to search this within one list, you can simply achieve this by:

  • Creating a choice column with all the country names or parent-child term combinations
  • Designate the column as an index column
  • Create a page with an app part view of the list with search box enabled

For the scope you are attempting to achieve, it appears that this would be the most straight forward solution involving the least amount of programming hours. If I recall correctly, you can also utilize the child-parent hierarchy in your term store by indicating that the parent terms should be shown as well, but I have not dived into that area extensively as I found the termstore hierarchy structure difficult to manage if you have more than hundreds of standard terms with occasional needs of term updates.

If you are intent with splitting the parent and child for some reason, the easiest is probably to:

  • Create a choice column for all parent terms
  • Create a choice column for all child terms
  • Create a page that has filter webparts and form webparts to filter the list according to your requirements (You can look up the List Filter Webpart and the Form Webpart for additional information)

Both of these solutions will likely require much less programming involvement (such as involving CAML and webpart development). Good luck!

  • Thanks for you time. I am stuck using term store and taxonomy. So no other option except using it. How can I use it. Can I query it using .Net object model or any other way if I used visual studio primarily. – SP CON Jun 23 '17 at 21:45
0

You won't be able to get the children using the names of the terms. I think you need to use the guids for the term. For example if North America has the guid of fc01ae6d-8ed3-4872-9cef-d2199d52d61c then one of these.

MyManagedDataColumn:fc01ae6d-8ed3-4872-9cef-d2199d52d61c

MyManagedDataColumn:#0fc01ae6d-8ed3-4872-9cef-d2199d52d61c

I can never remember if adding the #0 says get the term and all the children or only get the term.

Check out this excellent tutorial on KQL. He gives some different prefixes GP0, GTSet, and GPP which allow you to get different tags and descendants. It is for doing the queries in a contentsearch web part, but I think they might work with REST too.

0

You can use synonymous and thesaurus too as alternative.

Simple powershell script will help you achieve the same.

A thesaurus is commonly used to expand acronyms. But you can also use a thesaurus to automatically include variations of a search term into the query for specific terminology used in your organization. An example thesaurus file input could look like this:

Key,Synonym,Language

IE,Internet Explorer Internet Explorer,IE UN,United Nations,en UN, Vereinte Nationen,de BAM,billing and account management billing and account management,

To deploy thesaurus from csv file below command will help

$searchApp = Get-SPEnterpriseSearchServiceApplication

Import-SPEnterpriseSearchThesaurus -SearchApplication $searchApp -Filename <Path>

More about this is here https://technet.microsoft.com/en-us/library/jj219579.aspx

PS: typed using handheld device, so for syntactic errors pls excuse.

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.