SharePoint 2013 KQL each query with xrank on multi value taxonomy field

1.5k Views Asked by At

In my search query I query for items which have a multi value taxonomy field.

The publishing page where I am running the query from also has the same multi value tax field (for example "color").

Example:

List Items (have color column)
- Item 1: Red, Blue
- Item 2: Yellow, Red, White
- Item 3: Red, Blue, Green
- Item 4: Black

Publishing Page (has color column)
- defined colors are: Red, Green

All items match "red", but "Item 3" is obviously my best match, as it has both Red and Green. I need to return all items. I do not want to filter, I want to rank items.

First attempt: The following query returns all items.
However not each single value out of my multi value field is boosted but only the whole value altogether.

ContentTypeId:0x010600C0DEB45360CF4E9EB452AEFE3A238A1CA1* XRANK(cb=100) MyColorManagedProperty:{Page.MyColorColumn} 

Problem: For example Item 4 will have the same ranking as item 1 and 2. The boost of 100 will only apply to Item 3 (which has Red AND Green). I need a solution where Item 1 and 2 are treated higher than Item 4 as they at least contain "Red".

Update 1: (in a previous version I used a multi value choice field) Technet: http://technet.microsoft.com/en-us/library/jj683123(v=office.15).aspx) - obviously multi choice fields are not supported. So in the meantime I switched to a multi value taxonomy field.

ContentTypeId:0x010600C0DEB45360CF4E9EB452AEFE3A238A1CA1* XRANK(cb=10) {|owstaxIdRsColor:{Page.RsColor}}

What I get is: XRANK (Property or Property or Property or ...)
What I want is: XRANK Property or XRANK Property or XRANK Property or ...`

Update 2: Proper bracket placing works its wonders - so I thought. I tried to reproduce the desired result recently and failed miserably. I'm still looking for a solution. The approach below does NOT work.

ContentTypeId:0x010600C0DEB45360CF4E9EB452AEFE3A238A1CA1* XRANK(cb=100) (owstaxIdRsColor:{|{Page.RsColor}})

The result is: ContentTypeId:0x010600C0DEB45360CF4E9EB452AEFE3A238A1CA1* XRANK(cb=100) (owstaxIdRsColor:((#0655a6c23-6f73-43d4-b451-d01e0400717f) OR (#0de2d6451-8825-4c4f-9b02-0b22089b6540))) which basically ranks every item with its "default" value (of 5.xxx).

0

There are 0 best solutions below