Skip to content

Add page-grouped search results with time decay#32

Merged
twaugh merged 3 commits intomainfrom
page-grouped-results
Mar 17, 2026
Merged

Add page-grouped search results with time decay#32
twaugh merged 3 commits intomainfrom
page-grouped-results

Conversation

@twaugh
Copy link
Copy Markdown
Owner

@twaugh twaugh commented Mar 17, 2026

Summary

  • Page grouping: when multiple blocks from the same page match a query, they collapse into an expandable page group showing the best score and block count. Journal pages are never grouped.
  • Time decay: journal results get bounded exponential decay (floor 0.85, scale 180 days) so recent entries rank above older ones.
  • Adaptive thresholds: short queries (1-3 words) require 4 blocks to group; longer queries (8+) require 6, via linear interpolation.
  • Density bonus: harmonic decay (1/i weighting) with W_MAX=0.15 prevents pages with a few mediocre matches from outranking better individual results.
  • Overfetch: 2x topK candidates fetched for reranking, balancing grouping accuracy with avoiding excessive grouping.
  • Page group interactions: click to expand/collapse, Shift+click/Enter opens page in sidebar, Ctrl+C copies [[page reference]], copy button on hover.

Test plan

  • npx vitest run — 74 tests pass (18 new ranking tests)
  • npm run build succeeds
  • Manual test: short query shows page groups, long query shows individual blocks
  • Manual test: page groups expand/collapse, keyboard nav works
  • Manual test: old journal entries rank slightly lower than recent ones
  • Manual test: journal filter hides/shows grouped results correctly
  • Recreate demo gif

🤖 Generated with Claude Code

@twaugh twaugh force-pushed the page-grouped-results branch 3 times, most recently from 81cc578 to 9f5f4ca Compare March 17, 2026 13:05
When multiple blocks from the same non-journal page match a query,
they are collapsed into a page group showing the best block's score
and block count. Groups expand/collapse on click, with keyboard
navigation and Shift+click/Enter to open in sidebar. Ctrl+C on a
page group copies a [[page reference]].

Short queries group aggressively (threshold 2); longer queries
require more hits (threshold 5) via linear interpolation. Density
bonus uses harmonic decay (1/i weighting) to avoid over-promoting
pages with a few mediocre matches. Journal pages are never grouped
but get bounded exponential time decay to favor recent entries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@twaugh twaugh force-pushed the page-grouped-results branch from 9f5f4ca to 51e74f2 Compare March 17, 2026 13:07
twaugh and others added 2 commits March 17, 2026 13:52
Raise grouping threshold (T_MIN 2→4, T_MAX 5→6) and reduce overfetch
multiplier (3→2) so pages need more matching blocks before being
collapsed into a group.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@twaugh twaugh merged commit f3804bc into main Mar 17, 2026
1 check passed
@twaugh twaugh deleted the page-grouped-results branch March 17, 2026 13:57
@twaugh twaugh mentioned this pull request Mar 17, 2026
8 tasks
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.

1 participant