diff --git a/kallithea/lib/indexers/daemon.py b/kallithea/lib/indexers/daemon.py --- a/kallithea/lib/indexers/daemon.py +++ b/kallithea/lib/indexers/daemon.py @@ -203,7 +203,7 @@ class WhooshIndexingDaemon(object): writer.add_document( fileid=p, owner=unicode(repo.contact), - repository_rawname=repo.name_unicode, + repository_rawname=safe_unicode(repo_name), repository=safe_unicode(repo_name), path=p, content=u_content, @@ -242,7 +242,7 @@ class WhooshIndexingDaemon(object): raw_id=unicode(cs.raw_id), owner=unicode(repo.contact), date=cs._timestamp, - repository_rawname=repo.name_unicode, + repository_rawname=safe_unicode(repo_name), repository=safe_unicode(repo_name), author=cs.author, message=cs.message, diff --git a/kallithea/lib/vcs/backends/base.py b/kallithea/lib/vcs/backends/base.py --- a/kallithea/lib/vcs/backends/base.py +++ b/kallithea/lib/vcs/backends/base.py @@ -97,6 +97,9 @@ class BaseRepository(object): @LazyProperty def name(self): + """ + Return repository name (without group name) + """ raise NotImplementedError @property diff --git a/kallithea/tests/functional/test_search_indexing.py b/kallithea/tests/functional/test_search_indexing.py --- a/kallithea/tests/functional/test_search_indexing.py +++ b/kallithea/tests/functional/test_search_indexing.py @@ -125,6 +125,25 @@ class TestSearchControllerIndexing(TestC {'q': q, 'type': searchtype}) response.mustcontain('>%d results' % hit) + @parametrize('reponame', [ + (u'indexing_test'), + (u'indexing_test-fork'), + (u'group/indexing_test'), + (u'this-is-it'), + ]) + @parametrize('searchtype,query,hit', [ + ('content', 'this_should_be_unique_content', 1), + ('commit', 'this_should_be_unique_commit_log', 1), + ('path', 'this_should_be_unique_filename.txt', 1), + ]) + def test_searching_under_repository(self, reponame, searchtype, query, hit): + self.log_user() + + response = self.app.get(url(controller='search', action='index', + repo_name=reponame), + {'q': query, 'type': searchtype}) + response.mustcontain('>%d results' % hit) + @parametrize('searchtype,query,hit', [ ('content', 'this_should_be_unique_content', 1), ('commit', 'this_should_be_unique_commit_log', 1),