Changeset - 82fb2a161ddf
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-08-16 11:05:04
marcin@python-works.com
fixes issue #524
- fixed search by filename
- added missing test for this search
2 files changed with 13 insertions and 0 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/indexers/__init__.py
Show inline comments
 
@@ -86,12 +86,13 @@ CHGSETS_SCHEMA = Schema(
 
    removed=TEXT(),
 
    changed=TEXT(),
 
)
 

	
 
CHGSET_IDX_NAME = 'CHGSET_INDEX'
 

	
 

	
 
class MakeIndex(BasePasterCommand):
 

	
 
    max_args = 1
 
    min_args = 1
 

	
 
    usage = "CONFIG_FILE"
 
@@ -215,12 +216,17 @@ class WhooshResultWrapper(object):
 
            f_path = f_path.lstrip(os.sep)
 
            content_short = self.get_short_content(res, docid[1])
 
            res.update({'content_short': content_short,
 
                        'content_short_hl': self.highlight(content_short),
 
                        'f_path': f_path
 
                      })
 
        elif self.search_type == 'path':
 
            full_repo_path = jn(self.repo_location, res['repository'])
 
            f_path = res['path'].split(full_repo_path)[-1]
 
            f_path = f_path.lstrip(os.sep)
 
            res.update({'f_path': f_path})
 
        elif self.search_type == 'message':
 
            res.update({'message_hl': self.highlight(res['message'])})
 

	
 
        log.debug('result: %s' % res)
 

	
 
        return res
rhodecode/tests/functional/test_search.py
Show inline comments
 
@@ -87,6 +87,13 @@ class TestSearchController(TestControlle
 
        self.log_user()
 
        response = self.app.get(url(controller='search', action='index'),
 
                    {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545',
 
                     'type': 'commit'})
 

	
 
        response.mustcontain('1 results')
 

	
 
    def test_search_file_name(self):
 
        self.log_user()
 
        response = self.app.get(url(controller='search', action='index'),
 
                    {'q': 'README.rst', 'type': 'path'})
 

	
 
        response.mustcontain('2 results')
 
\ No newline at end of file
0 comments (0 inline, 0 general)