none
Creating refinement Query by combining two bins RRS feed

  • Question

  • Hi,


    I am trying to create refinement Query using FQL for getting result by combination of two bins within a same category...
    Suppose,
    'Result Type' is my category and I have filters under result category like...

    Result Category
    ------------------
    Microsoft Word (25)
    PowerPoint (4)
    Web (1)
    PDF(2)

    And I want new bin like combination of 'Mcrosoft word'and 'PowerPoint'. and I am expecting result category refinement count like below

    (This is my custom Refinement Panel where i have combined the two bins)

    Result Category
    -------------------
    Microsoft Word;PowerPoint (29)
    Web (1)
    PDF(2)

    The combined bins token i am fetching by FQL and here is my FQL Query

    string queryXML2 = @"
                                    
                                  </Context>
                                  <ResultProvider>FASTSearch</ResultProvider>
                                  <Range>
                                     <Count>1000</Count>
                                  </Range>
                                  <IncludeRefinementResults>
                                    <Refiners>                                 
                                      <Refiner>format</Refiner>                                 
                                    </Refiners>
                                  </IncludeRefinementResults>
                                     <RefinementFilters>
                                        <RefinementFilter>AQRKb2huBmF1dGhvcgEBXgEk</RefinementFilter>
                                        <RefinementFilter>AQ5TeXN0ZW0gQWNjb3VudAZhdXRob3IBAl4iAiIk</RefinementFilter>
                                    </RefinementFilters>
                               </Query>
                            </QueryPacket>";

    It works but it returns me intersect result but here I want consolidated result i.e. combination of 'Word' and 'PowerPoint'.

    So do I need to change my query or Any thing I am missing.?


    Thanks and Regards,
              Uday

    Reference I have used from http://msdn.microsoft.com/en-us/library/ff394639.aspx#refinement_specifying

    Friday, April 8, 2011 2:30 PM

Answers

  • Hi Uday,

    The standard API does not allow you to do "OR'ed" refinements. There is a possible workaround using the standard webpart to pass the undocumented "a" query parameter to pass an extra filter. But you are perhaps going via the query service? If so, I guess you can just add fielded queries to your normal search string?

    Regards


    Thomas Svensen | Microsoft Enterprise Search Practice
    • Marked as answer by Uday G Wednesday, April 13, 2011 7:53 AM
    • Unmarked as answer by Uday G Wednesday, April 13, 2011 7:53 AM
    • Marked as answer by Uday G Wednesday, April 13, 2011 11:29 AM
    Tuesday, April 12, 2011 2:42 PM
    Moderator
  • Hi Thomas,

    After brainstorming on you reply I did the following thing,...

    Now i am passing my query with undocumented "a" query parameter and in coresult webpart

    I overrided the ConfigureDataSourceProperties() method and I assign my query to 'FixedQuery' property of webpart.

    This works for me,

    Is this the approch you are trying to share.? If not then please let me know your approch in detail...

    Thanks and Regards,

    Uday

    Wednesday, April 13, 2011 7:45 AM
  • HI Uday,

    yes, that was the first approach.

    The other alternative is re-writing your FQL something like this: "and(<org-query, or(fileextension:docx, fileextension:pptx))". But it sounds as you've already found a nice, working solution. :-)

    Regards


    Thomas Svensen | Microsoft Enterprise Search Practice
    • Marked as answer by Uday G Wednesday, April 13, 2011 11:29 AM
    Wednesday, April 13, 2011 10:13 AM
    Moderator

All replies

  • Hi Uday,

    The standard API does not allow you to do "OR'ed" refinements. There is a possible workaround using the standard webpart to pass the undocumented "a" query parameter to pass an extra filter. But you are perhaps going via the query service? If so, I guess you can just add fielded queries to your normal search string?

    Regards


    Thomas Svensen | Microsoft Enterprise Search Practice
    • Marked as answer by Uday G Wednesday, April 13, 2011 7:53 AM
    • Unmarked as answer by Uday G Wednesday, April 13, 2011 7:53 AM
    • Marked as answer by Uday G Wednesday, April 13, 2011 11:29 AM
    Tuesday, April 12, 2011 2:42 PM
    Moderator
  • Hi Thomas,

    Thanks for reply,

    Yes I am using query web service to get the refinement token.

    Can you please elaborate on both the approches you have mentioned...

     

    Thanks and Regards,

    Uday

    Tuesday, April 12, 2011 2:56 PM
  • Hi Thomas,

    After brainstorming on you reply I did the following thing,...

    Now i am passing my query with undocumented "a" query parameter and in coresult webpart

    I overrided the ConfigureDataSourceProperties() method and I assign my query to 'FixedQuery' property of webpart.

    This works for me,

    Is this the approch you are trying to share.? If not then please let me know your approch in detail...

    Thanks and Regards,

    Uday

    Wednesday, April 13, 2011 7:45 AM
  • HI Uday,

    yes, that was the first approach.

    The other alternative is re-writing your FQL something like this: "and(<org-query, or(fileextension:docx, fileextension:pptx))". But it sounds as you've already found a nice, working solution. :-)

    Regards


    Thomas Svensen | Microsoft Enterprise Search Practice
    • Marked as answer by Uday G Wednesday, April 13, 2011 11:29 AM
    Wednesday, April 13, 2011 10:13 AM
    Moderator
  • Thanks Thomas for your valuable suggestion.
    Wednesday, April 13, 2011 11:29 AM