Iterates over a set of search results, with the top scoring result on top.

A "SearchResult" object has the following methods:

  • WikiPage getPage() - Gets the current WikiPage
  • int getScore() - Returns the score. The score is an arbitrary number, which does not necessarily mean anything, except that the best match should always have the highest score.

Usage#

<wiki:SearchResultIterator list="<list variable name>" 
                           id="<iterator variable name>" 
                           maxItems="<integer>">

Parameters#

list
Name of the variable which contains the search results. Must be a Collection or an Iterator with "SearchResult" -class elements.
id
Name of the variable to create containing an individual search result. Will contain a "SearchResult" class object.
maxItems
How many items to iterate over.

Example#

   <wiki:SearchResultIterator id="searchref" start="${param.start}" maxItems="<%=maxitems%>">
      <tr>
        <td><wiki:LinkTo><wiki:PageName/></wiki:LinkTo></td>
        <td><span class="gBar"><%= searchref.getScore() %></span></td>
      </tr>

      <c:if test="${param.details == 'on'}">
      <%
        String[] contexts = searchref.getContexts();
        if( (contexts != null) && (contexts.length > 0) ) 
        {
      %>  
      <tr class="odd" >
        <td colspan="2" >
          <div class="fragment">
      <%
          for (int i = 0; i < contexts.length; i++) 
          {
      %>
            <%= (i > 0 ) ? "<span class='fragment_ellipsis'> ... </span>" : ""  %>
            <%= contexts[i]  %>
      <%
          }
      %>
           </div>
         </td>
       </tr>
      <% 
        }
      %>
      </c:if><%-- details --%>
   </wiki:SearchResultIterator>

Category.Tags