Show More
@@ -124,18 +124,25 b' class WhooshSearcher(BaseSearcher):' | |||
|
124 | 124 | query = qp.parse(safe_unicode(query)) |
|
125 | 125 | log.debug('query: %s (%s)', query, repr(query)) |
|
126 | 126 | |
|
127 | reverse, sortedby = False, None | |
|
128 | if search_type == 'message': | |
|
129 | if sort == 'oldfirst': | |
|
130 |
|
|
|
127 | def sort_def(_direction, _sort_field): | |
|
128 | field2whoosh = { | |
|
129 | 'message.raw': 'message', | |
|
130 | 'author.email.raw': 'author', | |
|
131 | } | |
|
132 | return field2whoosh.get(_sort_field) or _sort_field | |
|
133 | ||
|
134 | reverse, sorted_by = False, None | |
|
135 | direction, sort_field = self.get_sort(search_type, sort) | |
|
136 | if sort_field: | |
|
137 | if direction == Searcher.DIRECTION_DESC: | |
|
138 | reverse = True | |
|
139 | if direction == Searcher.DIRECTION_ASC: | |
|
131 | 140 | reverse = False |
|
132 | elif sort == 'newfirst': | |
|
133 | sortedby = 'date' | |
|
134 | reverse = True | |
|
141 | sorted_by = sort_def(direction, sort_field) | |
|
135 | 142 | |
|
136 | 143 | whoosh_results = self.searcher.search( |
|
137 | 144 | query, filter=allowed_repos_filter, limit=None, |
|
138 | sortedby=sortedby, reverse=reverse) | |
|
145 | sortedby=sorted_by, reverse=reverse) | |
|
139 | 146 | |
|
140 | 147 | # fixes for 32k limit that whoosh uses for highlight |
|
141 | 148 | whoosh_results.fragmenter.charlimit = None |
General Comments 0
You need to be logged in to leave comments.
Login now