4

I am able to use the refinementfilters with the search api to refine a search for documents in a document library with this:

/_api/search/query?querytext='(Search Term)+AND+(path:https://mysite.sharepoint.com/MySite/MyDocLibrary)'&refinementfilters='Color:equals("Green")'

In this case I have a site column named Color, and I added the alias Color to the existing managed property RefinableString00 and mapped it to the Color column.

That works fine and it will refine the search to documents that contain the search term and also match the color property equal to "Green".

But is there anyway to refine a search based on values in a lookup column, if that lookup column allows multiple values?

So if the lookup column was called Skills (referencing a list called Skills), and a document might have multiple values for Skills (e.g. Javascript, Python, PHP, etc.) is there a way to use refinement filters for something like that within the Rest API?

  • It is possible with Multi values refiners . Will update you shortly with details. – John Zachariah Aug 10 '17 at 12:50
  • @JohnZachariah thanks if you can point me in the right direction or provide any details that would be great. – Frank Aug 13 '17 at 20:50
1

In My experience, instead of mapping with RefinableString00, Please create a new Managed Property with the correct properties like Searchable, refinable ,queryable and Multi Valued , then Map it to the crawled property. So by that way you can get Multi Valued refiner.

CA--> Search Service Application--> Search Schema--> Managed Properties--> Create New Managed Properties and have the required properties .

Allow Multiple Values

Then use this Managed properties in your REST API refinement filter that would work.

We have done similar thing.

  • Thanks, I'm using Sharepoint online, and unfortunately it doesn't allow you to set Refinable to "Yes" when creating new managed properties. It only allows it on the built-in managed properties. I can refine using Choice fields and multiple values mapping RefinableString00, but need it to also work for lookup fields, and am stuck there. – Frank Aug 17 '17 at 14:33
  • @Frank Agree with you...I verified in Online. if you go to "manage search schema" , click on new Managed Property, instead of selecting exisiting Refinable string, it does NOT allow you to select either Refinable or Sortable, that's so bad thing. Microsoft should allow admins/Devs to select the choice. Also it does not allow us to select the type other than Text , Yes/No..Come on MS, you can do better. – John Zachariah Aug 26 '17 at 14:03

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.