Search results sort as the filter dialog says (#959)

* Search results sort as the filter dialog says

Docs sorted ascending orders backwards and fell back to id order for every
descending order (`-size`, `-published_datetime`); it now takes the same `-`
prefixed orders as the other searches and rejects unknown ones with a 400.

Archives and Docs searches without an order now put the most relevant results
first, as Videos does and as the dialog shows.

Rank has no direction in the dialog: choosing it sends `rank` (most relevant
first) instead of inheriting a descending `-rank` (least relevant first).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* An old -rank link becomes rank when the filter dialog closes

The dialog shows Rank without a direction, but it seeded its draft from the URL
unchanged, so Done left a saved `-rank` (least relevant first) in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-11-11 19:42:23 -07:00 • committed by GitHub
parent 2800112f3e
commit f1d344d8a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 170 additions and 33 deletions

View file

@ -361,7 +361,7 @@ async def test_search_docs_browse_walks_file_group_date_index(test_session, test
docs[2].file_group.published_datetime = datetime(2021, 1, 1, tzinfo=timezone.utc)
test_session.commit()
sql = _doc_browse_sql('published_datetime')
sql = _doc_browse_sql('-published_datetime')
plan = ' '.join(row[3] for row in test_session.execute(text(f'EXPLAIN QUERY PLAN {sql}'),
dict(limit=20, offset=0)).fetchall())
assert 'file_group_published_datetime_idx' in plan, plan