--- a/qmsk/irclogs/handlers.py Sun Sep 13 01:15:56 2009 +0300
+++ b/qmsk/irclogs/handlers.py Sun Sep 13 18:47:00 2009 +0300
@@ -151,7 +151,7 @@
"""
The main channel view page, displaying the most recent lines
"""
-
+
# get latest events
lines = channel.source.get_latest(count)
@@ -231,12 +231,12 @@
else :
lines = channel.source.get_date(date)
max = None
-
+
# render channel_date
return _render_date (request, channel, date, lines, type, count, page, max)
@preferences.handler(prefs.formatter, prefs.count)
-def channel_search (request, channel, formatter, count, q=None, page=1, max=1, type=None, t=None) :
+def channel_search (request, channel, formatter, count, q=None, nick=None, page=1, max=1, type=None) :
"""
Display the search form for the channel for GET, or do the search for POST.
"""
@@ -244,19 +244,12 @@
# calculate skip offset from page/count
skip = (page - 1) * count
- # got a search query?
- if q :
- # attribute targets
- targets = dict(('search_%s' % target, True) for target in t if target in ('msg', 'nick')) if t else {}
+ if q or nick :
+ # search
try :
- # do search
- lines = log_search.get_index().search_simple(channel, q, count, skip, **targets)
+ lines = log_search.get_index().search_advanced(channel, q, nick, count, skip)
- # update max?
- if max and page > max :
- max = page
-
except log_search.NoResultsFound :
# no results
lines = None
@@ -264,7 +257,13 @@
else :
# just display the search form
lines = None
-
+
+
+ # max?
+ if max and page > max :
+ max = page
+
+
# type?
if type and lines :
# special type
@@ -282,7 +281,8 @@
prefs = request.prefs,
channel = channel,
search_query = q,
- search_targets = t,
+ search_nick = nick,
+ show_results = (q or nick),
count = count,
page = page,
skip = skip,