Rules:
Rules helps us to validate a condition before/during/after search execution.
Ensure to use meaningful names while creating rules.
Query Cleaning Rules(QCR)
QCR helps to clean up the query triggered from front end and process something specific before the actual query starts execution.
Example 1: Say we need to set a JSON template for transport layer, below query helps for the same.
Name: Set Json Transport Template
If all of the following conditions are met:
Every query
Perform the following actions:
Set backend parameter sp_t to value json.tpl
Example 2: Say we have both content and product searches, to enable the content search we can set up a rule as below,
Name: Content Search
If all of the following conditions are met:
Query segment equal value content
Perform the following actions:
Set custom variable content to value 1
So if the query parameter contains term segment='content', the query gets executed and it sets a variable content = '1' in backend, so that in our template, we can redirect the code to retrieve value for content search by testing this variable.
Direct Hits(DH)
This rules gets executed directly on meeting the condition.
Query Pattern:
website_URL: term1, term2, term3
In this case, when the query term contains term1 or term2 or term 3, the website_URL gets executed. Search gets redirected to the url.
Pre-Search Rules(PSR)
This rules are useful when we need to validate something before the search starts.
Example 1
Name: Load Simulator
If all of the following conditions are met:
In simulation mode
Perform the following actions:
Set targeted template to simulator
Example 2
Name: Load RSS Feeds
If all of the following conditions are met:
Query q contains value rss
Perform the following actions:
Set targeted template to feed
Example 3
Name: Set Default Content Template
If all of the following conditions are met:
Custom variable content equal value 1
Perform the following actions:
Set targeted template to Content_XML
Post Search Rules (PSR)
This helps to adjust the result post the search execution(Before displaying on screen). Say we need to remove some unwanted data from search results, in such cases this rule can be used.
Example 1
Name: check if discontinued items exists in results
If all of the following conditions are met:
Custom variable discontinued not equal value 0
Perform the following actions:
Set template's backend parameter sp_x_16 in template *targeted for search *primary to value discontinued
Set template's backend parameter sp_q_16 in template *targeted for search *primary to value 1
Business Rules(BR)
Business rules helps to execute some specific business rules on search. Say we need to display a promotonal banner on top of the search results.
Example 1
Name: Business Rule Ferrari
If all of the following conditions are met:
Keyword equal Ferrari
Perform the following actions:
Set banner in area top to banner Ferrari - the top one
Example 2
Name: Promote Specific Items
If all of the following conditions are met:
Every query
Perform the following actions:
Push group sp_cs = UTF-8 sp_p = all sp_q = * spc_no_field_table = 1 Product-Type = Product for search default to position 1
Push group sp_cs = UTF-8 sp_p = all sp_q = * spc_no_field_table = 1 Product-Type = Product2 for search default to position 2
Push group sp_cs = UTF-8 sp_p = all sp_q = * spc_no_field_table = 1 Product-Type = Product3 for search default to position 3
Ranking Rules
Ranking Rules allow you to modify the relative positioning of Search results based on contained meta tag content and/or related Adobe Analytics metrics.
Example 1
(Meta Tag) salesrank 10 - Maximum Importance
Set rank
regexp -[[:digit:]][[:digit:]][[:digit:]][[:digit:]] -1