none
How to OR refiners ( Query string manipulation ) RRS feed

  • Question

  • Hi All,

    I'm developing a custom refinement panel and need some help.

    If I'm not mistaken + is used for AND operator. Does anybody know how to OR refiners? 

    Ex: k=%23&r=test%3D%22AQZUb3duIDEMcmVzdG9yYW50b3duAQJeIgIiJA%3D%3D%22

    Ex2: k=%23&r=test%3D%22AQZUb3duIDIMcmVzdG9yYW50b3duAQJeIgIiJA%3D%3D%22

    In the above, there are two different queries for different test property values.

    What I want to do is to form a query which have more than one values for a specific managed property.

    Could anybody help me to combine them to acquire a single query?

    Thanks in advance.

    Wednesday, November 23, 2011 5:30 PM

Answers

  • Hi Yavuz,

    Have you tried KQL with "a" query parameter.?, I think below example will help you to solve your problem,

    Consider "format" managed property where you want to do ORing with its refiners, for this scenario the KQL will be,

    (format="Microsoft Word" OR format="Web Page")

    This will goes with "a" query parameter as like below,

    http://localhost/sites/search/Pages/results.aspx?k=keyword&a=(format:"Microsoft Word" OR format:"Web Page")

    Hope, this will help you,

    Thanks and Regards,

    Uday

    Monday, November 28, 2011 4:54 AM

All replies

  • Hi Yavuz

    One possible way of achieving this, is by using the "..&a=..." parameter instead of "...&r=..." to pass additional query parameters which are not shown in the search box. The syntax for a-parameters is the same as for k-parameters. I know there is an MSDN library page mentioning this, but I just couldn't find it right now.

     

    Regards

     


    Thomas Svensen | Microsoft Consulting Services
    Thursday, November 24, 2011 9:36 AM
    Moderator
  • Thanks for your reply Thomas,

     

    I also tried to find something related with "a" parameter, but I couldn't either. If you can find any documentation, please let me know.

    By the way, does "a" paramter can be used instead of "r" parameter to filter the results for a specific managed property?

     

    Sincerely

    Thursday, November 24, 2011 11:40 AM
  • Hi Yavuz,

    Have you tried KQL with "a" query parameter.?, I think below example will help you to solve your problem,

    Consider "format" managed property where you want to do ORing with its refiners, for this scenario the KQL will be,

    (format="Microsoft Word" OR format="Web Page")

    This will goes with "a" query parameter as like below,

    http://localhost/sites/search/Pages/results.aspx?k=keyword&a=(format:"Microsoft Word" OR format:"Web Page")

    Hope, this will help you,

    Thanks and Regards,

    Uday

    Monday, November 28, 2011 4:54 AM
  • Hi Uday,

    I checked your example and managed to OR specific managed property, also combine them with other managed properties with any operators(AND , OR) like that:

     http://localhost/sites/search/Pages/results.aspx?k=keyword&a=( author:"ihsanoktayanar" AND (format:"Microsoft Word" OR format:"Web Page"))

    Thanks so much.

    Monday, November 28, 2011 11:31 AM