Is it possible to create a query rule and have the condition match a keyword in a complex KQL query? For example the following query is being issued from a third party application using the REST endpoint. Could we create a query rule that would fire on the query below for the condition "query contains programmer"?



Sure, create the rule and use:

  • Advanced Query Text Match
  • Query contains one of these phrases (semi-colon separated) = Programmer

On a side note you know you can also configure "Query Client Types" and give the developers an ID to pass with their query for logging and performance tuning.

  • I've created a rule that matches fine when only a simple keyword query is performed. However when i add any KQL syntax the rule doesn't fire. Thanks for the tip on client types!
    – user706803
    Feb 26 '15 at 16:10
  • Over on Search Explained Mikael Svenson pointed out ""Every query condition becomes false if the query is not a simple keyword query, such as if it has quotes, property filters, parentheses, or special operators. " this may be causing your Query rule to fail. Feb 27 '15 at 13:19
  • So I guess it's not possible to use query rules for more advanced queries? That's sad news...
    – user706803
    Feb 27 '15 at 17:06
  • The problem was with the syntax of my query. Once I corrected the query the rule fired successfully. I ended up breaking the query up and using the QueryTemplate for the property filtering.
    – user706803
    Feb 27 '15 at 18:22

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.