|
a/Allura/allura/ext/search/search_main.py |
|
b/Allura/allura/ext/search/search_main.py |
|
... |
|
... |
55 |
startrow=page*pagesize
|
55 |
startrow=page*pagesize
|
56 |
count=0
|
56 |
count=0
|
57 |
if not q:
|
57 |
if not q:
|
58 |
q = ''
|
58 |
q = ''
|
59 |
else:
|
59 |
else:
|
60 |
pids = [c.project._id] + [
|
60 |
# Search all subprojects
|
61 |
p._id for p in c.project.subprojects ]
|
61 |
project_match = 'url_s:%s*' % c.project.url()
|
62 |
project_match = ' OR '.join(
|
62 |
# Exclude Thread results
|
63 |
'project_id_s:%s' % pid
|
|
|
64 |
for pid in pids )
|
|
|
65 |
search_query = '%s AND is_history_b:%s AND (%s) AND -deleted_b:true' % (
|
63 |
search_query = '%s AND is_history_b:%s AND (%s) AND -deleted_b:true' % (
|
66 |
q, history, project_match)
|
64 |
q, history, project_match)
|
|
|
65 |
search_query += ' AND NOT type_s:Thread AND NOT type_s:Discussion AND NOT type_s:Post'
|
67 |
results = search.search(search_query, is_history_b=history, short_timeout=False, rows=pagesize, start=startrow)
|
66 |
results = search.search(search_query, is_history_b=history, short_timeout=False, rows=pagesize, start=startrow)
|
68 |
if results: count=results.hits
|
67 |
if results: count=results.hits
|
69 |
return dict(q=q, history=history, results=results or [], count=count)
|
68 |
return dict(q=q, history=history, results=results or [], count=count)
|
70 |
|
69 |
|