4

On a list I have a field that links to the term store (managed metadata service application). Users can select multiple terms that are organized in a hierarchy.

TermSet
    Parent 1
        Child 1 1
        Child 1 2
    Parent 2
        Child 2 1
        Child 2 2

I added a managed property (Powershell New-FASTSearchMetadataManagedProperty, queryable, MergeCrawledProperties = true) and mapped it to the crawled property (ows_taxid_....) by using the comandlet New-FASTSearchMetadataCrawledPropertyMapping

Lets say I have a list item heaving "Child 1 2" selected for that field.

When I query this field with fast query language, i get the multiple guid in the result (e.g. #7e4884b4-9318-4144-856b-0e05058d98be #07e4884b4-9318-4144-856b-0e05058d98be #f7f995fa-6e8f-432a-9c37-f9db6d750e1c). These id's contain the id of the term set, the id of "Parent 1" and the id of "Child 1 2". But thats not what i want. I expected to only get "Child 1 2" since thats what I selected for the item.

The problem is that this makes it impossible for me to find out what term really was selected. Especially if the usere selects multiple terms because than the id's of that term (and its parents ids) are just added to the list of ids without any additional separator.

Does anyone have an idea what i did wrong or how i can get only the id's of the selected terms?

  • Try mapping it to ows_ColumnName instead of ows_taxid_ColumnName. ows_taxid_ returns result for child terms also. – Garima Oct 21 '13 at 8:46
  • @Garima I tried that and it worked (event though I got the name of the term, but that would be ok for my case) when I only selected one term. But when I select multiple terms the field in the result is empty. – tschuege Oct 21 '13 at 8:55
  • ok. Just for knowledge, are you using SP 2010 or 2013? – Garima Oct 21 '13 at 9:00
  • May be this link could help social.technet.microsoft.com/Forums/sharepoint/en-US/… – Garima Oct 21 '13 at 9:04
  • @Garima: I tried it with VariantType 4127 instad of 31. This way i get a all the term names but still not delimited with any separator so i have no clue what terms were selected. – tschuege Oct 21 '13 at 12:06
0

In 2013 we use

string.Format("GP0|#{0}",termId)

to make sure we only get hits on the direct term ID, and not children or parent terms.

Not sure if this is the same for 2010, but since most of the search in 2013 is stuff from FAST in 2010 it might be worth a shot!

Note that this is done in our KQL queries and not in the managed property per se.

  • I guess you do that formatting to use it in the query. But i'm not querying for the field. I just want to read it from the result. – tschuege Oct 21 '13 at 13:08
  • Yes, this is indeed for a query on the specific field. The funny thing is that SP manages both of this problems great internally, so it is a shame it is so hard when you do search in your own webparts for example – Robert Lindgren Oct 21 '13 at 13:11
0

@Robert - Good answer however want to add some more info to it.

To refine on managed metadata column Refinement filter text should look like this:

{ManagedPropertyName}:"{Keyword}|#{GUID for the taxonomy item}

ManagedPropertyName: Get from search schema.

Possible Keyword values:

  1. GP0 - for that specific taxonomy value
  2. GPP - for all the children excluding itself
  3. GTSet - for the whole term set

GUID : Get from the term store

Sample rest search call would look like this:

http://localhost/_api/search/query?querytext='test'
&refinementfilters='owstaxIdStrategy:"GP0|%234541c4f8-2d6f-4f6e-be1f-d989d4f97cf4"'
&clienttype='ContentSearchRegular'

More info can be found in following link: http://www.techmikael.com/2014/03/s15e01-kql-basics.html

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.