<%
  var results = recognitionResults['com.solveforall.recognition.solveforall.AnswerGenerator'];

  if (!results || (results.length === 0)) {
    throw "No Answer Generators found";
  }   
      
  var IMAGE_URL_BASE = 'https://solveforall.com/libs/jquery-raty/img/';
   
  function makeRatingHtml(rating) {
    var intRating = Math.floor(rating);    
    var escapedRating = _(rating).escapeHTML();
    
    var s = '<span title="Rating: ' + escapedRating + '">';  
    s += ' <span class="sr-only">' + escapedRating + '</span>';
   
    var i = 0;
    for (i = 0; i < intRating; i++) {
      s += '<img src="' + IMAGE_URL_BASE + 'star-on.png" width="16" height="16" alt="">';
    }
    
    var fractionRating = rating - intRating;
    if (fractionRating >= 0.5) {
      s += '<img src="' + IMAGE_URL_BASE + 'star-half.png" width="16" height="16" alt="">';
    }

    i += 1;

    for (; i <= 5; i++) {
      s += '<img src="' + IMAGE_URL_BASE + 'star-off.png" width="16" height="16" alt="">';                                  
    }

    return s;                  
  }
                 
  function makeNumUsersText(numUsers) {
    if (numUsers === 0) {
      return 'no users';             
    } else if (numUsers === 1) {
      return '1 user';             
    }
    return numUsers + ' users';                                  
  }
%>
<!doctype html>
<html>
  <head>
    <title>Answer Generators</title>        
    <meta name="com.solveforall.meta.answer.uri" content="https://solveforall.com/catalog/answer_generator/find?q=<%= encodeURIComponent(q) %>">
  </head>
  <body>
    
    <table class="table table-condensed">
      <thead>
        <tr>
          <th>Name</th>
          <th>Provider</th>          
          <th>Categories</th>                    
          <th>Rating</th>          
        </tr>
      </thead>
      <tbody>
        <% _(results).each(function (rr) { 
           var g = rr.answerGenerator;              
        %>          
          <tr>
            <td>
              <img src="<%= g.iconUrl || 'https://solveforall.com/blank.png' %>" width="16" height="16" alt="">
              <a href="https://solveforall.com/catalog/answer_generator/<%= g.id %>" ><%= g.name %></a>
            </td>
            <td>
              <% if (g.providerId) { %>
                <a href="https://solveforall.com/catalog/provider/<%= g.providerId %>"><%= g.providerName || "" %></a>
              <% } %>                 
            </td>       
            <td>
              <%= g.categories.join(', ') %>
            </td>                      
            <td>
              <%- makeRatingHtml(g.meanRating) %></%-> (<%= makeNumUsersText(g.numUsers) %>)
            </td>                      
          </tr>
        <% }); %> 
      </tbody>
    </table>
  </body>
</html>

Add Answer Generator to display Answer Generator search results
Add Answer Generator to display Answer Generator search results
