Question

In Sharepoint 2013, using Search REST API; I can get a result by using path in querytext query tag, like this:

http://host/_api/search/query?querytext='path=http://host/site/pages/index.aspx'

The problem is, I need to make multiple conditions for path to get result of both:

path='http://host/site/pages/index.aspx' and path='http://host/site/pages/someother.aspx'

I've tried the following sytax examples, but couldn't managed to get result:

..query?querytext='path=path1,path2'

..query?querytext='path=path1;path2'

..query?querytext='path=path1,path=path2'

..query?querytext='path=path1 or path2'

..query?querytext='path=((path1)or(path2))'

..query?querytext='path=path1'&querytext='path=path2'

and most probably a lot more.

Thanks in advance.

Was it helpful?

Solution

Now, using Sharepoint 2013 Seach Query Tool, I've found the syntax by chance.

It should be like:

..query?querytext='path=path1+path=path2'

OTHER TIPS

I find it hard to find info on sharepoint as well, a lot of trial and errors.

But I came across this http://msdn.microsoft.com/en-us/library/ff394606.aspx when I was working on it. It is using Fast Query Language to do the and/or/ornot condition, equals/lessthan etc...

What you can try is

..query?querytext='and(path:equals(path1), path:equals(path2))'

I can dig out the answer for u at work tomorrow, don't really remember, but that site above helped alot.

Below I have mentioned the sharepoint rest query to get folder path:

_api/search/query?querytext='Test+path:"https://serverName/Shared Documents/Folder1/Folder2"'

querytext - keyword path - folder path.

This query is worked for me. Kindly make use of it for your sharepoint Rest API query building.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top