Mercurial > kallithea
comparison rhodecode/lib/indexers/__init__.py @ 2389:324b838250c9 beta
UI fixes for searching
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 05 Jun 2012 00:48:20 +0200 |
parents | a0ef98f2520b |
children | 5f21a9dcb09d |
comparison
equal
deleted
inserted
replaced
2388:a0ef98f2520b | 2389:324b838250c9 |
---|---|
38 from whoosh.fields import TEXT, ID, STORED, Schema, FieldType | 38 from whoosh.fields import TEXT, ID, STORED, Schema, FieldType |
39 from whoosh.index import create_in, open_dir | 39 from whoosh.index import create_in, open_dir |
40 from whoosh.formats import Characters | 40 from whoosh.formats import Characters |
41 from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter | 41 from whoosh.highlight import highlight, HtmlFormatter, ContextFragmenter |
42 | 42 |
43 from webhelpers.html.builder import escape | 43 from webhelpers.html.builder import escape, literal |
44 from sqlalchemy import engine_from_config | 44 from sqlalchemy import engine_from_config |
45 | 45 |
46 from rhodecode.model import init_model | 46 from rhodecode.model import init_model |
47 from rhodecode.model.scm import ScmModel | 47 from rhodecode.model.scm import ScmModel |
48 from rhodecode.model.repo import RepoModel | 48 from rhodecode.model.repo import RepoModel |
229 | 229 |
230 def highlight(self, content, top=5): | 230 def highlight(self, content, top=5): |
231 if self.search_type != 'content': | 231 if self.search_type != 'content': |
232 return '' | 232 return '' |
233 hl = highlight( | 233 hl = highlight( |
234 text=escape(content), | 234 text=content, |
235 terms=self.highlight_items, | 235 terms=self.highlight_items, |
236 analyzer=ANALYZER, | 236 analyzer=ANALYZER, |
237 fragmenter=FRAGMENTER, | 237 fragmenter=FRAGMENTER, |
238 formatter=FORMATTER, | 238 formatter=FORMATTER, |
239 top=top | 239 top=top |