Changeset 1820

Show
Ignore:
Timestamp:
01/30/09 14:45:12 (14 months ago)
Author:
JensDiemer
Message:

search plugin: Bugig in the result page (print the same line over and over again)... Insert a JavaScript? Link for the complete <tr> segment.

Location:
trunk/pylucid_project
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid_project/media/PyLucid/internal_page/search/result_page.css

    r1449 r1820  
    99#search_result table tr:hover { 
    1010    background-color: #fafafa; 
     11    cursor: pointer; 
    1112} 
    1213#search_result .cutouts { 
  • trunk/pylucid_project/media/PyLucid/internal_page/search/result_page.html

    r1449 r1820  
    1313    <table> 
    1414    {% for entry in results %} 
    15     <tr> 
     15    <tr onclick="JavaScript:window.location.href='{{ entry.page.get_absolute_url }}';" title="{{ entry.page.get_absolute_url }}"> 
    1616        <td title="score">{{ entry.score }}</td> 
    1717        <td> 
  • trunk/pylucid_project/PyLucid/plugins_internal/search/search.py

    r1719 r1820  
    160160        for result in results: 
    161161            result["cutouts"] = [] 
    162             content = result["page"].content 
     162            page = result["page"] 
     163            content = page.content          
    163164 
    164165            for term in search_strings: 
    165                 start = 0 
     166                search_start = 0 
    166167                for _ in xrange(text_cutout_lines): 
    167168                    try: 
    168                         index = content.index(term, start) 
     169                        index = content.index(term, search_start) 
    169170                    except ValueError: 
    170171                        # No more hits in the page content 
    171172                        break 
    172  
    173                     start = index+1 
    174  
     173                     
    175174                    if index<text_cutout_len: 
    176175                        txt = content[:text_cutout_len] 
     
    179178                        end = index+text_cutout_len 
    180179                        txt = content[start:end] 
     180 
     181                    # start the next search at the end position 
     182                    search_start = end  
    181183 
    182184                    txt = escape(txt)