<%! from lonote.im3 import Book, Paper import hashlib path_template = '/edit/{bid}/{pid}/{sid}.html' %> <% results.fragmenter.maxchars = 20 results.fragmenter.surround = 20 %> <%def name="result_item(hit)"> <% book = bs[hit['bid']] target_sid_path = hit['path'] target_sid_desc = book.paper(hit['pid']).sections.data_meta(hit['sid']).get('desc') default_sid_path = path_template.format( bid = hit['bid'], pid = hit['pid'], sid = Paper.default_sid) book_path = '/edit/{bid}/{pid}/{sid}.html'.format( bid = hit['bid'], pid = book.rootpid, sid = Paper.default_sid) parent_name = None parent_path = '' try: parent_paper = book.paper(book.pid_parent(hit['pid'])) parent_name = parent_paper.name parent_path = path_template.format( bid = hit['bid'], pid = parent_paper.pid, sid = Paper.default_sid) except: pass string = hit['bid'] + hit['pid'] md5hex = hashlib.md5(string.encode('utf8')).hexdigest() highlight = '' try: highlight = hit.highlights('text', top = 3, minscore = 1) except: pass if highlight: margin = 'margin: 5px;' else: margin = 'margin-left: 5px; margin-right: 5px;' %>
  • % if hit['sid'] == Paper.default_sid: ${hit['sid'] | h} % else: ${hit['sid'] | h} % endif ${hit['pname'] | h}

    ${highlight}

  • ${_('Search Results of [ {} ]:').format(key)} ${results.scored_length()} / ${len(results)} / ${doc_count}