Skip to content

Commit 5b4b2ad

Browse files
committed
v2: first search should use 'relevant' sort order. #318
1 parent b46ea18 commit 5b4b2ad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/reader/_app/v2/__init__.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ def entries():
2828
reader = get_reader()
2929

3030
# TODO: search improvements
31-
# TODO: search bug: first search uses recent
3231
# TODO: paqgination
3332
# TODO: read time
3433

@@ -37,8 +36,12 @@ def entries():
3736
else:
3837
form = EntryFilter(request.args)
3938

40-
if form.args != request.args.to_dict():
41-
return redirect(url_for('.entries', **form.args))
39+
form_args = form.args
40+
if q := form_args.pop('Q', ''):
41+
form_args['q'] = q
42+
return redirect(url_for('.entries', **form_args))
43+
if form_args != request.args.to_dict():
44+
return redirect(url_for('.entries', **form_args))
4245

4346
feed = None
4447
if form.feed.data:

src/reader/_app/v2/forms.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def radio_field(*args, choices, **kwargs):
115115

116116
class EntryFilter(PresetsMixin, Form):
117117
feed = HiddenField("feed")
118-
search = SearchField("search", name='q')
118+
search = SearchField("search", name='Q')
119119
feed_tags = TagFilterField("tags", name='tags')
120120
read = radio_field("read", choices=BOOL_CHOICES, default='no')
121121
important = radio_field("important", choices=TRISTATE_CHOICES, default='maybe')
@@ -134,6 +134,7 @@ class EntryFilter(PresetsMixin, Form):
134134

135135

136136
class SearchEntryFilter(EntryFilter):
137+
search = SearchField("search", name='q')
137138
sort = RadioField(
138139
"sort", choices=['relevant'] + ENTRY_SORT_CHOICES, default='relevant'
139140
)

0 commit comments

Comments
 (0)