If you've ever worked with SharePoint Search, you've probably scratched your head wondering why your very simple query is not working. You know that you've mapped your managed property to a crawl property.
Sometimes it feels like the data is just not there, even though it should be.
Here's a little trick to check what data is actually in the search index. To do this we are going to hit the SharePoint REST API for Search, issue a basic query, and specify some fields that we want to get back.
In a browser of your choice, enter the following URL
https://yoursite.sharepoint.com/_api/search/query?querytext='customer'&selectproperties='Title,Author,ContentTypeId,RefinableString10'&RowLimit=1
You will want to update the parameters to suit your content. Enter a querytext value that will surface the results you want to interrogate. The title of a document is a good idea.
Let's break down the parameters, although you will probably find them quite self explanatory.
- querytext - any value that will narrow your results to return your desired content
- selectproperties - these are the managed property names separated by a comma.
- rowlimit - how many results to return.
In my case I wanted to see what was in the ContentTypeId field, and the RefinableString10 field.
Here's what I found:
So the ContentTypeId field is good, contains what I want, but to my surprise the RefinableString10 field which I thought I'd mapped properly has no value... ok back to the Search Schema for me.