Identify which business rules fired on a query using lw.rules.debug
Goal
Determine which business rules were triggered by a specific query, and confirm whether a rule is responsible for the result ordering or for which documents appear in the results. This is useful when the results returned for a query differ from what the underlying Solr query alone would produce, and you want to see whether a pin, boost, bury, or block rule is acting on the query.
Environment
Fusion 5.x (including Managed Fusion). Applies to query pipelines that apply business rules (the Apply Rules stage).
Background
Business rules can reorder, promote, demote, filter, or remove documents from a result set — for example, Pin and Boost raise or fix items at specific positions, Bury pushes items lower, and Block removes items. Other rule types modify the response or query rather than the result list.
Because rules like these change which documents appear and where, a rule that triggers on a query can produce results that differ from what the underlying Solr query alone would return. When results are not what you expect, listing the fired rules confirms whether a rule is the cause.
Use lw.rules.debug to list fired rules
Append the lw.rules.debug parameter to the query request. It causes Fusion to include, in the response, information about the business rules that were triggered during the request. Either 1 or true works as the value.
Add it directly to a query profile / pipeline request URL:
https://FUSION_HOST/api/apps/APP_NAME/query/QUERY_PROFILE?q=SEARCH_TERMS&lw.rules.debug=true
In the Query Workbench, set lw.rules.debug=1 as a query parameter to include the fired-rules information in the response.
Interpreting the output
Review the list of triggered rules and their actions against the behavior you are investigating. If a pin, boost, bury, or block rule is acting on the document or query in question, adjust, disable, or republish that rule and re-run the query to confirm the change.
An example of the JSON response including a list of "applicable_rules" follows:
Notes
The lw.rules.debug parameter is also set (with a value of 1) on the built-in rules-simulator query profiles, so the same fired-rules information is available when simulating rules against a staging rewrite collection.