Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Sort filtered collection page URLs #2384

Merged
merged 4 commits into from
Feb 12, 2025
Merged

fix: Sort filtered collection page URLs #2384

merged 4 commits into from
Feb 12, 2025

Conversation

SuaYoo
Copy link
Member

@SuaYoo SuaYoo commented Feb 12, 2025

Fixes #2383

Changes

  • Fixes unpredictable sort order when typing in collection page URL
  • Fixes page URL results flickering in and out while typing

Manual testing

  1. Log in as crawler
  2. Go to collection with archived items
  3. Click "Set Initial View"
  4. Choose "Start Page"
  5. Click "Page URL" input. Verify initial options are shown, sorted by snapshot count
  6. Start typing. Verify options are shown sorted by page URL

Screenshots

Page Image/video
Collection detail Screenshot 2025-02-11 at 5 54 10 PM

Follow-ups

If we support $text, we could potentially sort by match score.

@@ -764,11 +764,13 @@ async def list_urls_in_collection(
crawl_ids = await self.get_collection_crawl_ids(coll_id)

match_query: dict[str, object] = {"oid": oid, "crawl_id": {"$in": crawl_ids}}
sort_query: dict[str, int] = {"count": -1, "_id": 1}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tw4l I did a quick pass on this to get it working, feel free to push any suggestions directly!

Copy link
Member

@tw4l tw4l left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a quick fix to the typing, otherwise this is great and working well :) Thank you!

@tw4l
Copy link
Member

tw4l commented Feb 12, 2025

If we support $text, we could potentially sort by match score.

Unfortunately the way $text works isn't very conducive to our use cases. It reads any special character as a place to split strings for tokenization, so it has completely unusable results for URLs 😢

@tw4l tw4l merged commit f7b9b73 into main Feb 12, 2025
27 checks passed
@tw4l tw4l deleted the fix-page-url-sort-order branch February 12, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Collection Page URL filtering not showing exact matches
2 participants