0

In sharepoint 2013 search rest api, I have a more complex query filter, that I would want to group by brackets with and and or operators. How can this be done?

I have something like

field1:A OR (field1:B AND field2:C)

how can I do something like this in the querytext parameter?

Thanks

4
  • Have you tried it? using the url ?$filter=Field1 eq 'A' OR (Field1 eq 'B' AND Field2 eq 'C')
    – Mike
    Oct 14 '16 at 22:24
  • That's for when u query the list directly, but for search rest, isn't it using the way I have?
    – omega
    Oct 14 '16 at 22:25
  • Yes, you are right. I found this:msdn.microsoft.com/en-us/library/ff394606.aspx and it suggests you should be using FQL, using and() and or(). So the query text should be something like: query?querytext='or(field1:equals('A'), and(field1:equals('B'), field2:equals('C'))
    – Mike
    Oct 14 '16 at 22:34
  • Also, use this tool to figure out your querytext: sp2013searchtool.codeplex.com
    – Mike
    Oct 14 '16 at 22:39
0

something on the lines of:

/_api/search/query?querytext='*'&refinementfilters='OR(field1:A,AND("*",field1:B,field2:C))'

you need to have fql tho.

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.