I have a problem I am trying to figure out with the search API. Most of the time the file names are unique, but every once and a while there are two or more files in different libraries on the site with the same name. So in order to get the right file, we us the "path:" property in the REST call to narrow down the search to specific libraries.
However, I have noticed a problem when the library name has a space in it. If I use the "path:" property to search a library called ArchiveData (no spaces) the search works just fine and pulls back the document I need. However, if the library name is "Current Data" (with a space) then I get no files back.
https://<site>/_api/search/query?querytext = '(Document.doc)+AND+(path:https://<site>/ArchiveData/'
will return one document from this library.
This URL however doesn't return any hits:
Doesn't work and I get no document. I have tried to escape the space with %20 in the library name with no luck. Can someone tell me how to encode the path for a library that has spaces in the name?
I also noticed in some of the libraries that we have that have dashes in the name the dash is replaced with a space, so it too fails in the "path:"