%
var results = collection.models;
var numberOfHits = collection.numberOfHits;
var query = model.get('query');
var firstResultStart = model.get('rows') * collection.page;
%>
    <% if (collection.errors.length > 0) { %>
        
            
                <% if (collection.errors.includes("TOO_MANY_TERMS")) { %>
                    - Your search exceeds the maximum permitted number of search terms (30).
 
                <% } %>
                <% if (collection.errors.includes("TOO_MANY_CHARS")) { %>
                    - Your search exceeds the maximum permitted number of characters (500).
 
                <% } %>
                <% if (collection.errors.includes("TOO_COMPLEX_PREFIX_OPERATORS")) { %>
                    - Your search is too complex. Please reduce the complexity of your query.
 
                <% } %>
            
         
    <% } else if (collection.warnings.length > 0) { %>
        
            
                <% if (collection.warnings.includes("SYNTAX_AUTO_CORRECTED")) { %>
                    - There was an error in the boolean syntax of your query. Here are some results based on what we think you might have meant to write.
 
                <% } %>
            
         
    <% } %>
    <% if (numberOfHits === 0 && query !== "") { %>
        
Your search did not match any documents
        Suggestions:
        
            - Make sure all words are spelled correctly.
 
            - Try different keywords.
 
            - Try more general keywords.
 
            - If you have used boolean syntax, check that it is valid.
 
        
    <% } else { %>
        
            <%= numberOfHits %> results
        
        <% n = firstResultStart + 1 %>
        
            <% qweriLodash.each(results, function(resultModel) { %>
                <%
                    var result = resultModel.attributes;
                    var displayTitle = "Untitled";
                    var displayTitleClass = " untitled";
                    if (!qweriLodash.isEmpty(result.documentTitle)) {
                        displayTitle = result.documentTitle;
                        displayTitleClass = "";
                    }
                %>
                - 
                    
                        
                        <% if (result.snippet) { %>
                            
                                <%= result.snippet %>
                            
                        <% } %>
                        <%  if (result.type === 'NOTE' && !qweriLodash.isEmpty(query)) { %>
                            
                                By <%= result.annotationUsername %>
                            
                        <% } %>
                    
                 
            <% }); %>
        
    <% } %>