I am using the SharePoint search api to get the documents from the libraries. I have a managed property call L1DTI corresponding to a custom column. Now I do not want the search results where this property value is empty.

Below is my query

var url = "https://<site>/_api/search/query?querytext='sharepoint'
&refinementfilters='and(L1DTI:not(" "),ContentTypeId:(0x0120*),contentclass:(\"STS_ListItem_DocumentLibrary\"))'";

The above query is working fine except when I am passing empty string in L1DTI.

Something like this L1DTI:not("xyz") is working fine and the search results are coming where 'xyz' is not present. So its just the problem with the empty string I guess.

So is there any way that we can pass the empty string in the property. Or maybe is there any method by which we can exclude the null values from our search results.

Thanks in advance..


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.