Skip to content

A stale document of a decaying source ranks at 0.6 of its score and says it is stale - #23

Merged
gedaiu merged 1 commit into
re-devfrom
feat/source-decay-rank
Oct 22, 2026
Merged

gedaiu merged 1 commit into
re-devfrom
feat/source-decay-rank

Conversation

@gedaiu

@gedaiu gedaiu commented Oct 22, 2026

Copy link
Copy Markdown

Slice 5 of 5 of RC-003 (a source may decay), on top of #21. Search now uses what the earlier slices record.

What is in it.

  • decay::stale_documents: of the documents a search found, those that belong to a source with decay set and have not been retrieved for the source's stale_after_days (from the last retrieval, else from creation). Worked out in the database, never stored; confidence is untouched.
  • hybrid_scored multiplies the RRF score of a stale document's hit by 0.6 (STALE_SEARCH_WEIGHT, Lore's weight for a stale fact) and reorders before paging, so a stale document can drop off a page and not only move within it. The sort is stable.
  • A demoted hit carries stale: true. The field is omitted when false, so a base where no source decays sees no change in its responses.
  • docs/design/chat-and-mcp.md and RC-003 say so.

Cost. One extra query per search, keyed on the returned documents' ids, for every base (it returns nothing where no source decays).

Tests. A unit test pins the 0.6 factor and the reorder, and that a list with nothing stale keeps its order and scores; a store test pins which documents count as stale (only in a decaying source, past stale_after_days, and not after a retrieval); a server test searches the same query before and after its source starts to decay and pins that the score is exactly 0.6 of the earlier one.

Checked locally on the rebased branch: cargo fmt --check, cargo clippy --workspace --all-targets -D warnings, cargo test --workspace (1692 passed, 1 failed: name_vectors::plan_tests::pending_reads_the_name_facts_through_the_predicate_index, which passes alone 3 of 3 and is not touched by this diff; looks load-sensitive).

🤖 Generated with Claude Code

…ays it is stale

Signed-off-by: Bogdan Szabo <bogdan@re-cinq.com>
@gedaiu
gedaiu merged commit 0d81a0c into re-dev Oct 22, 2026
6 checks passed
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