##// END OF EJS Templates
search: goto commit search will now use a safe search option and never...
marcink -
r1411:16beb154 default
parent child Browse files
Show More
@@ -178,7 +178,8 b' class HomeController(BaseController):'
178 178 user_id=c.rhodecode_user.user_id, ip_addr=self.ip_addr)
179 179 searcher = searcher_from_config(config)
180 180 result = searcher.search(
181 'commit_id:%s*' % commit_hash_prefix, 'commit', auth_user)
181 'commit_id:%s*' % commit_hash_prefix, 'commit', auth_user,
182 raise_on_exc=False)
182 183
183 184 return [
184 185 {
@@ -187,7 +188,8 b' class HomeController(BaseController):'
187 188 'type': 'commit',
188 189 'obj': {'repo': entry['repository']},
189 190 'url': url('changeset_home',
190 repo_name=entry['repository'], revision=entry['commit_id'])
191 repo_name=entry['repository'],
192 revision=entry['commit_id'])
191 193 }
192 194 for entry in result['results']]
193 195
@@ -39,9 +39,11 b' class BaseSearch(object):'
39 39 def cleanup(self):
40 40 pass
41 41
42 def search(self, query, document_type, search_user, repo_name=None):
42 def search(self, query, document_type, search_user, repo_name=None,
43 raise_on_exc=True):
43 44 raise Exception('NotImplemented')
44 45
46
45 47 def searcher_from_config(config, prefix='search.'):
46 48 _config = {}
47 49 for key in config.keys():
@@ -60,12 +60,12 b' FRAGMENTER = ContextFragmenter(200)'
60 60 log = logging.getLogger(__name__)
61 61
62 62
63
64 63 class Search(BaseSearch):
65 64
66 65 name = 'whoosh'
67 66
68 67 def __init__(self, config):
68 super(Search, self).__init__()
69 69 self.config = config
70 70 if not os.path.isdir(self.config['location']):
71 71 os.makedirs(self.config['location'])
@@ -99,8 +99,9 b' class Search(BaseSearch):'
99 99 query = u'(%s) OR %s' % (query, hashes_or_query)
100 100 return query
101 101
102 def search(self, query, document_type, search_user, repo_name=None,
103 requested_page=1, page_limit=10, sort=None):
102 def search(self, query, document_type, search_user,
103 repo_name=None, requested_page=1, page_limit=10, sort=None,
104 raise_on_exc=True):
104 105
105 106 original_query = query
106 107 query = self._extend_query(query)
General Comments 0
You need to be logged in to leave comments. Login now