# HG changeset patch # User Vincent Duvert # Date 2012-06-06 21:02:21 # Node ID 30589acf820e2895a835860aaa076296fcd7073a # Parent 2fa7bcccf7c5867e0ac584f91fb75c967989d20b # Parent b0d09c20f608196c925b323967ffd3efc9c6fb81 Merge with latest changes diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -342,10 +342,17 @@ def make_map(config): rmap.connect('public_journal', '%s/public_journal' % ADMIN_PREFIX, controller='journal', action="public_journal") - rmap.connect('public_journal_rss', '%s/public_journal_rss' % ADMIN_PREFIX, + rmap.connect('public_journal_rss', '%s/public_journal/rss' % ADMIN_PREFIX, + controller='journal', action="public_journal_rss") + + rmap.connect('public_journal_rss_old', '%s/public_journal_rss' % ADMIN_PREFIX, controller='journal', action="public_journal_rss") rmap.connect('public_journal_atom', + '%s/public_journal/atom' % ADMIN_PREFIX, controller='journal', + action="public_journal_atom") + + rmap.connect('public_journal_atom_old', '%s/public_journal_atom' % ADMIN_PREFIX, controller='journal', action="public_journal_atom") diff --git a/rhodecode/controllers/journal.py b/rhodecode/controllers/journal.py --- a/rhodecode/controllers/journal.py +++ b/rhodecode/controllers/journal.py @@ -192,8 +192,8 @@ class JournalController(BaseController): ttl=self.ttl) for entry in journal[:self.feed_nr]: - action, action_extra = h.action_parser(entry, feed=True) - title = "%s - %s %s" % (entry.user.short_contact, action, + action, action_extra, ico = h.action_parser(entry, feed=True) + title = "%s - %s %s" % (entry.user.short_contact, action(), entry.repository.repo_name) desc = action_extra() feed.add_item(title=title, @@ -225,8 +225,8 @@ class JournalController(BaseController): ttl=self.ttl) for entry in journal[:self.feed_nr]: - action, action_extra = h.action_parser(entry, feed=True) - title = "%s - %s %s" % (entry.user.short_contact, action, + action, action_extra, ico = h.action_parser(entry, feed=True) + title = "%s - %s %s" % (entry.user.short_contact, action(), entry.repository.repo_name) desc = action_extra() feed.add_item(title=title, diff --git a/rhodecode/lib/indexers/__init__.py b/rhodecode/lib/indexers/__init__.py --- a/rhodecode/lib/indexers/__init__.py +++ b/rhodecode/lib/indexers/__init__.py @@ -40,7 +40,7 @@ from whoosh.index import create_in, open 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 @@ -57,6 +57,7 @@ ANALYZER = RegexTokenizer(expression=r"\ #INDEX SCHEMA DEFINITION SCHEMA = Schema( + fileid=ID(unique=True), owner=TEXT(), repository=TEXT(stored=True), path=TEXT(stored=True), @@ -230,7 +231,7 @@ class WhooshResultWrapper(object): if self.search_type != 'content': return '' hl = highlight( - text=escape(content), + text=content, terms=self.highlight_items, analyzer=ANALYZER, fragmenter=FRAGMENTER, diff --git a/rhodecode/lib/indexers/daemon.py b/rhodecode/lib/indexers/daemon.py --- a/rhodecode/lib/indexers/daemon.py +++ b/rhodecode/lib/indexers/daemon.py @@ -146,10 +146,12 @@ class WhooshIndexingDaemon(object): u_content = u'' indexed += 1 + p = safe_unicode(path) writer.add_document( + fileid=p, owner=unicode(repo.contact), repository=safe_unicode(repo_name), - path=safe_unicode(path), + path=p, content=u_content, modtime=self.get_node_mtime(node), extension=node.extension @@ -214,8 +216,11 @@ class WhooshIndexingDaemon(object): if mtime > indexed_time: # The file has changed, delete it and add it to the list of # files to reindex - log.debug('adding to reindex list %s' % indexed_path) - writer.delete_by_term('path', indexed_path) + log.debug('adding to reindex list %s mtime: %s vs %s' % ( + indexed_path, mtime, indexed_time) + ) + writer.delete_by_term('fileid', indexed_path) + to_index.add(indexed_path) except (ChangesetError, NodeDoesNotExistError): # This file was deleted since it was indexed @@ -230,6 +235,7 @@ class WhooshIndexingDaemon(object): for path in self.get_paths(repo): path = safe_unicode(path) if path in to_index or path not in indexed_paths: + # This is either a file that's changed, or a new file # that wasn't indexed before. So index it! i, iwc = self.add_doc(writer, path, repo, repo_name) diff --git a/rhodecode/templates/search/search.html b/rhodecode/templates/search/search.html --- a/rhodecode/templates/search/search.html +++ b/rhodecode/templates/search/search.html @@ -65,7 +65,7 @@ ${h.end_form()} - +