none
Operators in FQL - FS4SP RRS feed

  • Question

  • Hello Experts,

    Requesting your suggestions on this plz!!

    When users enter Boolean operators(OR, AND,NOT,NEAR), brackets, double quotes as part of search keyword, the operators should be considered as operators and not as search keywords. Words within double quotes should be considered as phrase and FAST should perform phrase search for the same.

    Sample query:

    ((high and court)or(policy and “highcourt amendment”) and "legislation or act" not (media))

    In the above example for the part

    (policy and “highcourt amendment”)

    “highcourt amendment” à phrase search

    Policyàsingle keyword search

    (high and court) à Both the keywords high,court need to be searched

    Much Thanks..


    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..
    Monday, July 18, 2011 10:35 AM

Answers

  • Freddie,

    As far as I know -/+ is only supported in simple mode queries. But you could do a combination to ease the parsing. From your original post:

    ((high and court)or(policy and “highcourt amendment”) and "legislation or act" not (media))

    and(
      or(
       string:("high court", mode="simpleall"),
       string:("policy \"highcourt amendment\"", mode="simpleall")
      ),
      string:("legislation act", mode="simpleany),
      not:string("media")
    )


    Taking group by group from the innermost first and building it up as you expand outwards. It's one approach at least. The other is to parse it token by token and build something like an expression tree which you convert to fql.

    Regards,
    Mikael Svenson 


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Wednesday, July 20, 2011 11:33 AM

All replies

  • Hello Freddie,

    What exactly is your question? Do you want users to write queries like this in the oob search web parts, or do you want to know how to convert such queries to FQL?

    As for operators used with SharePoint keyword syntax (kql), they have to specified in upper case in order to be treated as operators, which makes parsing queries a lot easier.

    But you could still write a parser for your requirements over to fql. It just takes some work.

    Regards,
    Mikael Svenson 


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Monday, July 18, 2011 7:20 PM
  • But you could still write a parser for your requirements over to fql. It just takes some work.

    Hi Mike.. Thanks for taking the time in responding!!

    The simple parser is something we already have in place. But its getting complex to write a parser program for a complex operator.

    I was just looking if there is a way by which FAST itself takes the operators like (),+,- and covert to FQL operators.

    For instance, when user types in the Search box "Car OR Bike", We need to have a FQL like, OR(content:string("car", mode="simpleall", annotation_class="user"), content:string("bike", mode="simpleall", annotation_class="user"))... 'content' here is my compound field..

    And this question is subjected to both FS4SP and ESP5.3 environments.

    Much Thanks again!!


    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..
    Wednesday, July 20, 2011 7:19 AM
  • Hello Freddie,

    You can turn "car OR bike" into -> content:string("car bike", mode="simpleany"). You can also use +/- with simpleany/simpleall. The documentation on simpleall/simpleany can be found at http://msdn.microsoft.com/en-us/library/ff394471.aspx.

    Example: content:string("car bike -motorcycle", mode="simpleall"), will require car + bike, but not if motorcycle is present.

    As for nested groups with parenthesis you will have to write this yourself, parse it out to nested and(and(.... fql type queries.

    (and I hope you're not using regexp for the simple parser as it will quickly become difficult with the nested groups)

    Regards,
    Mikael Svenson 


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Wednesday, July 20, 2011 11:10 AM
  • As for nested groups with parenthesis you will have to write this yourself, parse it out to nested and(and(.... fql type queries.

    Hi Mike, Thanks again for the time!!

    Yeah, the simpleall/any is something we were not able to use for the same nested condition. 

    I was just wondering if FAST would take +/- operators and convert it internally to OR and AND as in FQL. Which I think is not a feature in FAST. I just wanted hear this from some experts so I can make sure that my assumption is true.

    In other words, I wanted to confirm that the only way to Query FAST for a complex nested condition is to write a equivalently complex parser logic and there is no way FAST Query pipeline can handle this.

    Much thanks!!

     


    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..
    Wednesday, July 20, 2011 11:23 AM
  • Freddie,

    As far as I know -/+ is only supported in simple mode queries. But you could do a combination to ease the parsing. From your original post:

    ((high and court)or(policy and “highcourt amendment”) and "legislation or act" not (media))

    and(
      or(
       string:("high court", mode="simpleall"),
       string:("policy \"highcourt amendment\"", mode="simpleall")
      ),
      string:("legislation act", mode="simpleany),
      not:string("media")
    )


    Taking group by group from the innermost first and building it up as you expand outwards. It's one approach at least. The other is to parse it token by token and build something like an expression tree which you convert to fql.

    Regards,
    Mikael Svenson 


    Search Enthusiast - SharePoint MVP/WCF4/ASP.Net4
    http://techmikael.blogspot.com/
    Wednesday, July 20, 2011 11:33 AM
  • Mike, Thanks for the wonderful reply and for the example.. I understand your approach. Much thanks...
    Freddie Maize ..A story with Glory is History. Doesn’t matter whether Glory rest in the world of Demon or God. Lets create History..
    Thursday, July 21, 2011 6:04 AM