Skip to content

Commit 1f1cd9f

Browse files
committed
search improvements
1 parent 1274947 commit 1f1cd9f

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

CHANGES.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
1.7.6 (unreleased)
22
------------------
33

4-
- Nothing changed yet.
4+
- search improvements [amleczko]
55

66

77
1.7.5 (2013-05-07)

por/dashboard/search.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,14 @@ def _do_search(self, sort_by=None):
243243
if realm_query:
244244
query = query.filter(realm_query)
245245

246+
# boosting
247+
query = query.boost_relevancy(5, realm="ticket")\
248+
.boost_relevancy(5, status="new")\
249+
.boost_relevancy(5, status="assigned")\
250+
.boost_relevancy(10, status="reopened")\
251+
.boost_relevancy(3, status="reviewing")\
252+
.boost_relevancy(5, status="accepted")
253+
246254
author_query = self._build_author_filter(si)
247255
if author_query:
248256
query = query.filter(author_query)
@@ -257,6 +265,7 @@ def _do_search(self, sort_by=None):
257265
return query.paginate(start=self.page_start, rows=self.page_size)\
258266
.highlight('oneline',
259267
**{'simple.pre':'<span class="highlight">',
268+
'snippets': 3,
260269
'simple.post':'</span>'})\
261270
.highlight('title',
262271
**{'simple.pre':'<span class="highlight">',
@@ -286,7 +295,7 @@ def _docs(self, query):
286295
class FullTextSearchObject(object):
287296
'''Minimal behaviour class to store documents going to/comping from Solr.
288297
'''
289-
def __init__(self, project, realm, id=None, score=None,
298+
def __init__(self, project, realm, id=None, score=None, status=None,
290299
title=None, author=None, changed=None, created=None,
291300
oneline=None, involved=None, popularity=None, comments=None,
292301
parent_id=None, solr_highlights=None , **kwarg):
@@ -307,6 +316,11 @@ def __init__(self, project, realm, id=None, score=None,
307316
self.id = id
308317
self.score = score
309318
self.parent_id = parent_id
319+
self.status = status
320+
321+
@property
322+
def closed(self):
323+
return self.status == 'closed'
310324

311325
@property
312326
def title(self):

por/dashboard/skins/search.pt

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
<li tal:condition="next"><a href="${next}">Next</a></li>
1414
</ul>
1515
<div id="results">
16-
<tal:result repeat="doc docs">
17-
<dt><a href="${request.application_url}/${doc.href()}"
16+
<div tal:repeat="doc docs" tal:omit-tag="">
17+
<dt tal:attributes="class doc.closed and 'ticketclosed'"><a href="${request.application_url}/${doc.href()}"
1818
tal:content="structure doc.title"></a></dt>
1919
<dd tal:content="structure doc.oneline"></dd>
2020
<dd>By <a href="${request.current_route_url(_query=add_param(request,'authors',doc.author))}">${doc.author}</a>
2121
in <a href="${request.current_route_url(_query=add_param(request,'tracs',doc.project))}">${doc.project}</a>
2222
</dd>
23-
</tal:result>
23+
</div>
2424
</div>
2525
<ul class="pager">
2626
<li tal:condition="previous"><a href="${previous}">Previous</a></li>

por/dashboard/static/css/dashboard.css

+3
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ table.time-entries tbody tr:hover th {
226226
div#results dt{
227227
margin: 1.5em 0 0;
228228
}
229+
div#results dt.ticketclosed a{
230+
color: gray;
231+
}
229232

230233
div#results .author{
231234
color: #090;

0 commit comments

Comments
 (0)