Skip to content
Jorge Reyes edited this page Jun 3, 2015 · 2 revisions

The OpenSearch extension Query element allows multiple instances of itself. So to allow this functionality ColdBox requires the opensearchQuery data to be supplied using a structured array. The example below creates three OpenSearch Queries. Two are related search terms while the other is the query request.

<cfset rc.feed["opensearchQuery"] = arrayNew(1) />
<cfset rc.feed["opensearchQuery"][1] = structNew() />
<cfset rc.feed["opensearchQuery"][1]["role"] = "request" />
<cfset rc.feed["opensearchQuery"][1]["searchterms"] = "General Motors annual report" />
<cfset rc.feed["opensearchQuery"][2] = structNew() />
<cfset rc.feed["opensearchQuery"][2]["role"] = "related" />
<cfset rc.feed["opensearchQuery"][2]["searchterms"] = "GM" />
<cfset rc.feed["opensearchQuery"][2]["title"] = "General Motors stock symbol" />
<cfset rc.feed["opensearchQuery"][3] = structNew() />
<cfset rc.feed["opensearchQuery"][3]["role"] = "related" />
<cfset rc.feed["opensearchQuery"][3]["searchterms"] = "automotive industry revenue" />
Clone this wiki locally