Best bets: data model
Best bets are be returned in the response.curator.exhibits
field as an exhibit of category=BEST_BETS
. Other curator exhibits, configured as curator rules may also be returned within this data model element.
Best bets are returned within the curator element as they are a special type of curator rule that contains hardcoded trigger and action rules, edited using an alternative simple interface. Best bets defined within this interface will not display on the curator editor screen. |
{
"question": {},
"response": {
"curator": {
"exhibits": [
{
"titleHtml": "Foodista on WikiPedia", (1)
"displayUrl": "https://en.wikipedia.org/wiki/Foodista.com", (2)
"linkUrl": "/s/redirect?collection=foodista~sp-foodista&url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FFoodista.com&auth=Pe8GypiW0aQUS7otoBMVSw&profile=_default&type=FP", (3)
"descriptionHtml": "<img class=\"pull-left img-responsive img-thumbnail\" style=\"width:180px; margin-right:10px; padding: 15px 0;\" src=\"/s/resources/foodista~sp-foodista/foodista.png\"/> Foodista.com is an online recipe, cooking, and food news source. Foodista is built by both registered community members and anonymous contributors through a structured wiki. With all content available under a Creative Commons Attribution 3.0 license, the site contains articles on recipes, foods, cooking tools, techniques, and food news.", (4)
"additionalProperties": { }, (5)
"category": "BEST_BETS" (6)
}
]
}
},
"session": {},
"QueryString": "collection=foodista~sp-foodista&profile=_default&log=false&query=foodista",
"anyExtraSearchesIncomplete": false,
"error":
}
1 | Curator exhibit title - this contains the best bet title text, and may include HTML tags. |
2 | Curator exhibit URL to display - this URL can be displayed as the URL for the best bet. |
3 | Curator exhibit link URL - this URL should be used as the href for the best bet. It will include a callback to the /s/redirect endpoint to support click tracking of best bets if click tracking is enabled. |
4 | Curator exhibit description. This is the best bet description, and may include HTML tags. |
5 | Curator additional properties. Not currently used by best bets. |
6 | Curator exhibit category. This is always set to BEST_BETS for a best bet. |
Best bets HTML
Best bets are commonly templated in HTML using a pattern similar to the code below:
<li>
<p><a href="{linkUrl}">{titleHtml}</a>
<br/><cite>{displayUrl}</cite></p>
<p>{descriptionHtml}</p> (1)
</li>
1 | Note that you may need to allow the pass-through of HTML tags when printing the description HTML, depending on if you allow your implementers to input formatted HTML in the description. |
Display best bets in a Freemarker results template shows the template code of how best bets are templated using Freemarker, which is used in the default Funnelback template. This example can be adapted to other languages.