Changeset - 324b838250c9
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-06-05 00:48:20
marcin@python-works.com
UI fixes for searching
2 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/indexers/__init__.py
Show inline comments
 
@@ -37,13 +37,13 @@ from shutil import rmtree
 
from whoosh.analysis import RegexTokenizer, LowercaseFilter, StopFilter
 
from whoosh.fields import TEXT, ID, STORED, Schema, FieldType
 
from whoosh.index import create_in, open_dir
 
from whoosh.formats import Characters
 
from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter
 

	
 
from webhelpers.html.builder import escape
 
from webhelpers.html.builder import escape, literal
 
from sqlalchemy import engine_from_config
 

	
 
from rhodecode.model import init_model
 
from rhodecode.model.scm import ScmModel
 
from rhodecode.model.repo import RepoModel
 
from rhodecode.config.environment import load_environment
 
@@ -228,13 +228,13 @@ class WhooshResultWrapper(object):
 
            yield (start_offseted, end_offseted,)
 

	
 
    def highlight(self, content, top=5):
 
        if self.search_type != 'content':
 
            return ''
 
        hl = highlight(
 
            text=escape(content),
 
            text=content,
 
            terms=self.highlight_items,
 
            analyzer=ANALYZER,
 
            fragmenter=FRAGMENTER,
 
            formatter=FORMATTER,
 
            top=top
 
        )
rhodecode/templates/search/search.html
Show inline comments
 
@@ -62,19 +62,20 @@
 
                </div>
 
             </div>
 

	
 
		</div>
 
	</div>
 
	${h.end_form()}
 

	
 
    <div class="search">
 
    %if c.cur_search == 'content':
 
        <%include file='search_content.html'/>
 
    %elif c.cur_search == 'path':
 
        <%include file='search_path.html'/>
 
    %elif c.cur_search == 'commit':
 
        <%include file='search_commit.html'/>
 
    %elif c.cur_search == 'repository':
 
        <%include file='search_repository.html'/>
 
    %endif
 
    </div>
 
</div>
 

	
 
</%def>
0 comments (0 inline, 0 general)