PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/kai/templates/docs/genindex.mako

Relevant Search: With Applications for Solr and Elasticsearch

For more in depth reading about search, ranking and generally everything you could ever want to know about how lucene, elasticsearch or solr work under the hood I highly suggest this book. Easily one of the most interesting technical books I have read in a long time. If you are tasked with solving search relevance problems even if not in Solr or Elasticsearch it should be your first reference. Amazon Affiliate Link
https://bitbucket.org/bbangert/kai/
Mako | 63 lines | 61 code | 2 blank | 0 comment | 13 complexity | 355126f3f0ab360dd5acb7f2ff4b48a9 MD5 | raw file
 1<div class="yui-b sphinx content">
 2    <h1>Index</h1>
 3    
 4    <%
 5        ind_len = len(c.doc['genindexentries']) - 1
 6    %>
 7    % for index, (key, dummy) in enumerate(c.doc['genindexentries']):
 8    <a href="#${key}"><strong>${key}</strong></a>
 9    % if index != ind_len:
10    |
11    % endif
12    % endfor
13    
14    % for loc, (key, entries) in enumerate(c.doc['genindexentries']):
15    <h2 id="${key}">${key}</h2>
16    <table width="100%" class="indextable"><tr><td width="33%" valign="top">
17    <dl>
18    <%
19        breakat = c.doc['genindexcounts'][loc] // 2
20        numcols = 1
21        numitems = 0
22        length = len(c.doc['genindexcounts'])
23    %>
24    % for entryname, (links, subitems) in entries:
25    <dt>
26        % if links:
27        <a href="${links[0]}">${entryname}</a>
28            % for here, link in enumerate(links[1:]):
29            , <a href="${link}">[${here+1}]</a>
30            % endfor
31        % else:
32        ${entryname}
33        % endif
34    </dt>
35    % if subitems:
36        <dd><dl>
37            % for subentryname, subentrylinks in subitems:
38            <dt><a href="${subentrylinks[0]}">${subentryname}</a>\
39                % for here, link in enumerate(subentrylinks[1:]):
40, <a href="${link}">${here+1}</a>
41                % endfor
42            % endfor
43        </dl></dd>
44    % endif
45    <% 
46        numitems = numitems + 1 + len(subitems)
47    %>
48    % if numcols < 2 and numitems > breakat:
49        <%
50        numcols += 1
51        %>
52        </dl></td><td width="33%" valign="top"><dl>
53    % endif
54    % endfor
55    </dl></td></tr></table>
56    % endfor
57</div>
58<%def name="title()">${parent.title()} - Documentation - Index</%def>
59<%inherit file="../layout.mako" />
60<%def name="styles()">
61${parent.styles()}
62${h.stylesheet_link('/css/sphinx.css')}
63</%def>