Skip to content

improvement(knowledge): page search results, take a custom date window, and rerank a person's search - #8060

Merged
waleedlatif1 merged 10 commits into
stagingfrom
improvement/search-experience-parity
Sep 20, 2026
Merged

waleedlatif1 merged 10 commits into
stagingfrom
improvement/search-experience-parity

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Closes the remaining experience gaps between the Search page and Glean/Onyx, on top of the filters fix (#8059):

  • Paging. The search asks for 20 chunks at first paint, as today; Show more runs a second, cached 50-chunk search under its own query key instead of widening the first request. Measured on a production-shaped copy: asking for 50 up front raises the keyword leg of a common term from 46–99 ms to 174–270 ms server time for a broad reader, and from 48–213 ms to 222–466 ms for a reader who reaches 3% of the index — so it is paid only when asked for
  • Custom date window. updated gains a custom range (from/to days in the URL), sent as an inclusive modifiedAfter/modifiedBefore window. modifiedBefore joins the filter contract (with a cross-field check), the filter intersection, the document conditions, the on-row date test, the filtered-set estimate and the bounded probe
  • Reranking. The dashboard search opts into the platform's cross-encoder reranker whenever a Cohere key is configured, with the default model; reranking stays best-effort, so a provider outage leaves the fused order in place
  • A filter-first probe (index-driven, bounded by the document limit) gets its own 1.5 s budget: a window at the limit enumerates in ~220 ms and ranks exactly in ~600 ms on the copy, a predictable path where a walk through a mostly-excluded neighbourhood is not
  • A walk that still has to ask the document per tuple (tag or date filter) keeps the default 20k scan instead of the on-row 100k cap, so a mostly-excluded neighbourhood ends in a short answer rather than a missed deadline

Not in this PR: an author filter (authors live in per-connector document tag slots with no index; it needs an index and the same estimate-then-probe treatment), and mirroring the document date onto the ranking rows so a date filter never asks the document at all — the cold-cache cost of wide date windows is the remaining gap and that mirror is its fix.

Type of Change

  • New feature

Testing

  • Results component: Show more appears only after a full first page and asks for the wider search; the custom window is sent as an inclusive range; the hook keys the wider search apart from the first paint
  • Route: the dashboard opts into the reranker when a key is configured. Contract and filter intersection tests for modifiedBefore. Retrieval tests: the filter-first probe budget, and the default scan for a walk carrying a document lookup. Each verified to fail with its fix reverted
  • Lint, block registry, check:audits, docs manifest pass; type-check clean; 2,175 UI/search tests pass

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel

vercel Bot commented Sep 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Sep 20, 2026 6:53pm UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 16 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/api/contracts/knowledge/search.ts Outdated
@greptile-apps

greptile-apps Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the latest change resolves the incomplete custom-range usability gap without introducing a new actionable defect.

Summary

Adds wider on-demand knowledge-search paging, inclusive custom date windows, credential-aware reranking, and retrieval-planner adjustments for filtered searches.

  • Keeps the initial search at 20 results and performs expansion as a separately cached 50-result query.
  • Propagates the custom upper date bound through validation, filter intersection, estimation, and keyword/vector retrieval.
  • Enables best-effort dashboard reranking when either workspace or platform Cohere credentials are available.
  • Gives index-driven filtered probes a dedicated budget and limits graph traversal when document lookups remain necessary.
  • The latest change ensures an incomplete custom range displays the date picker instead of leaving the user unable to finish the range.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Reader submits knowledge search] --> B{Custom range complete?}
    B -- No --> C[Show filters and wait for both dates]
    B -- Yes --> D[Run initial 20-result search]
    D --> E[Apply source and inclusive date filters]
    E --> F{Filtered set can be probed exactly?}
    F -- Yes --> G[Run bounded filter-first probe]
    F -- No --> H[Run constrained keyword/vector retrieval]
    G --> I[Fuse candidates]
    H --> I
    I --> J{Reranker credential available?}
    J -- Yes --> K[Best-effort cross-encoder reranking]
    J -- No --> L[Keep fused ordering]
    K --> M[Render results]
    L --> M
    M --> N{Reader selects Show more?}
    N -- Yes --> O[Run separately cached 50-result search]
Loading

Reviews (8) · Last reviewed commit: "fix(knowledge): show the filters while a..."

Comment thread apps/sim/app/api/knowledge/search/route.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

Comment thread apps/sim/lib/knowledge/reranker.ts Outdated
@waleedlatif1
waleedlatif1 force-pushed the improvement/search-filters-on-row branch from 318f2eb to 1b59f04 Compare September 20, 2026 18:13
@waleedlatif1
waleedlatif1 force-pushed the improvement/search-experience-parity branch from c56e22f to 4d3e75d Compare September 20, 2026 18:15

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review completed against the latest diff

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/knowledge/application/search.ts Outdated
Comment thread apps/sim/lib/knowledge/reranker.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 21 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

@waleedlatif1
waleedlatif1 changed the base branch from improvement/search-filters-on-row to staging September 20, 2026 18:31
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

…w, and rerank a person's search

- the Search page asks for 50 chunks, collapses them to one card per document, shows ten at a time and reveals more on request
- `updated` gains a custom range: `from`/`to` days in the URL, sent as an inclusive `modifiedAfter`/`modifiedBefore` window; `modifiedBefore` joins the filter contract, the filter intersection, the document conditions, the on-row date test, the filtered-set estimate and the bounded probe
- the dashboard search opts into the platform's cross-encoder reranker whenever a Cohere key is configured; reranking stays best-effort
… and start a refined search at its first page

- the filters schema stays a plain object so the Assistant's search input can still extend it; the window's order is checked on the request body
- the dashboard asks for reranking outright, and the use case reranks only when the workspace or the platform holds a key
- a refinement of the filters starts over at the first page after the reader asked for more
- a custom window's days are the reader's local days
…y, and let a custom window be cleared

- the credential check tries the platform key before a workspace lookup, and counts a caller's own key only off hosted Sim, as the resolver does
- a custom window with no days yet searches nothing and says so; another window drops the days; the picker's Clear reaches the URL through a forwarded `onClear`
@waleedlatif1
waleedlatif1 force-pushed the improvement/search-experience-parity branch from 368f1d3 to 3d5cb80 Compare September 20, 2026 18:34
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 21 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/knowledge/search/queries.ts Outdated
…n range, and keep the default scan while rows are unfilled

- a custom window searches only once both days are chosen; the picker shows the chosen range instead of a fixed label
- while the projection still holds rows the backfill has not filled, an on-row walk keeps the default scan cap, since an unfilled row is decided through its document; the answer is read off the unfilled-rows index and remembered for a minute
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 21 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/sim/lib/knowledge/search/queries.ts
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 21 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit ea31ca7 into staging Sep 20, 2026
37 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/search-experience-parity branch September 21, 2026 06:47

This branch was previously deployed

1 inactive deployment
Preview e2e90937 Deployed Sep 20, 2026 by vercel[bot]
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