Add Feed triggers to a given application or page
- In Mashup Builder, select a page and then select its Feeds view.
-
From the Triggers > Feed
Triggers
pane, drag the Feed (or Mashup API) triggers that you want to apply to
the application level or to the page level.
Table 1. Feed triggers description Feed Trigger
Description
Category name regexp processing
Uses regular expressions to search and replace category names for a given feed.
It contains the following properties:
-
Facets– Enter the facet name.
-
Search for – Enter a Java regular expression string to search for a specific category name.
-
Replace with – Enter a Java regular expression string to replace the category name found by the Search for string by another category name.
Look up the reference for
String.replaceAll()
for further information.Create facet
Creates pseudo-facets on the fly. This can be useful to create virtual facets for feeds returning a lot of unsorted hits.
For example, an XML feed returns several hits, one hit corresponds to a color meta and we want to use this meta as a facet in a pie chart to represent a pie section.
It contains the following properties:
- meta name – Enter the meta name.
- facet name – Enter the facet name.
- facet description – Enter a description
Query Builder
This is the most important trigger.
It computes simple queries out of a feed result to override another feed's query. In other words, it allows you to programmatically build a query using previously fetched results, assembling metas, facets, etc.
Important: The current feed must be synchronized, otherwise unexpected behavior may occur! To synchronize the feed, select the Feeds view, and in the Feed Options section, set the Synchronized property to true. Sorting is important if you select the Synchronized option in the feed properties. It determines the execution order of your feeds. The first feed in the drop zone is executed first, when results are retrieved, the second feed is executed etc. It contains the following properties:
-
xml – Displays the
XML code that will be used by the trigger. This code contains the following
nodes (the values in green are sample values only):
-
<string value="str" />
: Appends the string "str" to the query. It is useful for static query chunks. -
<join glue=" OR ">
: Joins the values generated by the embedded nodes using the specified glue. -
<metaValues metaName="title" max="3" quotes="true"/>
: Retrieves up to 3 values of the "title" meta and surrounds them with quotes for an exact match query. -
<facetLeaves facetId="coffee" max="10" quotes="true" />
: Retrieves up to 10 values of the "coffee" facet and surrounds them with quotes for an exact match query. -
<expr expr="${feeds["feedname"].metas["metaname"] + 10}" />
: Executes the specified MEL expression. -
<replace pattern="fo[uo]" replacement="bar" caseInsensitive="false">
: Applies the specified replacements on the values generated by embedded nodes. -
<if test="${expr}">
: Executes the specified MEL expression test, and if true, calls the embedded generator nodes. You must format the node as follows:<if test="> <then> ... </then> <else> ... </else> </if>
Important: Using only <if test="> ... </if>
does not work.
-
- Feed to override – Enter the name of the feed to override or simply select it from the list of available feeds from the Values tab (on the left).
- Parameter to override – Enter the feed parameter to override.
-
Execution mode – Select the
trigger mode:
- beforeQuery: builds the query for the current feed.
- afterQuery: allows to take the feed's results to build a query for another feed.
- Query Builder
- Enable feed if disabled – Enables the feed if it is disabled, that is to say, if the Feed options > Enable property is set to false. You can indeed choose to disable a feed by default to launch it only if the query builder is executed to build a specific query. Note: This property is used only in afterQuery mode, that is to say after the execution of a first query.
- Launch if empty – Launches the QueryBuilder trigger if the feed is empty or has no results. Note: This property is used only in afterQuery mode, that is to say after the execution of a first query.
JSON to Meta Trigger
Transforms JSON meta values into metas. This is useful for the collaborative widgets returning unreadable and unusable JSON strings that bring valuable information.
It contains the following property:
jsonMetaNames – Enter the JSON meta name that must be transformed into a standard Exalead CloudView meta.
Recommendation Trigger
Defines the feed that will be used for result-condition-based analysis in the Content Recommender. It checks whether the triggers have matched on the page.
Important: The current feed must be synchronized and placed on top of the recommendation feeds, otherwise unexpected behavior may occur. To synchronize the feed, select the Feeds view, and in the Feed Options section, set the Synchronized property to true. Transform Categories
Applies transformations to a single category using a JavaScript expression. It contains the following property:
JavaScript expression – Enter a JavaScript expression to transform a specific category (available object:
category
) For example:category.count = category.count / 2
Transform Facets
Applies transformations to a single facet using a JavaScript expression.
It contains the following property:
JavaScript expression – Enter a JavaScript expression to transform a specific facet (available object:
facet
) For example:facet.name = \"New facet name\"
Table 2. Page Feed Triggers description Page Feed Trigger
Description
Aggregation Builder
This trigger can be added to the Page or to the Application level. It adds on-the-fly aggregations to a given facet. For example, you can add an aggregation to get the percentage corresponding to each category.
The calculation can also be performed using the values of different feeds. For example, FeedA relates to a group of items, FeedB relates to one of these items, and you want to make a comparison between these two.
Limitation: This trigger does NOT work with MultiDimension facets and Hierarchical2D facets.
It contains the following properties:
- Target Feed – Specifies the target feed on which you want to create on-the-fly aggregations.
- Target Facet – Specifies the target facet on which you want to create on-the-fly aggregations.
-
Facet
Iteration mode – Specifies the iteration mode used to iterate
each facet category. For example, the "Year" facet is set to YYYY/MM/dd:
- ALL – recursive iteration,
- FLAT – iteration on the first facet level, in our example: 2010, 2011, 2012, etc.
- LEAVES – iteration on the last facet level, in our example: Monday, Tuesday, Wednesday, etc.
- Aggregation name – Specifies the aggregation name.
- MEL expression (Facet level) – Enter the MEL expression that will be evaluated at facet level to create the target aggregation value.
- MEL expression (Category level) – Enter the MEL expression that will be evaluated at category level to create the target aggregation value.
Example:
Target feed:
cloudview
,area
,percent
,100
,${(category.count*100)/feed.facets["myfacet"].count}
Join feed trigger
This trigger allows you to Join several feeds using a meta as key. It should be used with a query builder
It contains the following property:
Feeds to join: A list of feeds that you want to join using a given joinKey. The first feed of the list will contain the result of the join.
-
- Click Save and then Apply your configuration changes.