Skip to content

fix(search): restore cross-field Cmd-K matches - #6193

Closed
waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/search-cross-field-match
Closed

fix(search): restore cross-field Cmd-K matches#6193
waleedlatif1 wants to merge 1 commit into
stagingfrom
fix/search-cross-field-match

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #6192, fixing a regression Cursor Bugbot caught there after it merged.

#6192 moved folder paths out of the primary fuzzy haystack into filterAndCap's toExtra parameter, so an exact name match could no longer be outranked by a folder that happened to fuzzy-match. That ranking fix was right, but scoreItem matches the name or the secondary text and never the two together — so a query spanning both stopped matching at all:

Fix

scoreItem now falls back to matching the two fields joined, but only when neither matches alone. Ordering matters: the joined attempt runs last so a secondary-text hit still cannot masquerade as a name hit, preserving the ranking #6192 established.

Positions from the joined match don't index into either field — safe here only because filterAndSort scores with them and discards them. Called that out in the TSDoc so nobody later feeds them to a highlighter.

Type of Change

  • Bug fix

Testing

  • 4 new tests covering cross-field match, name-beats-secondary ranking, secondary-only match, and non-match
  • Mutation-checked: reverting the fix turns the cross-field test red
  • tsc and bun run lint:check 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)

Routing folder paths through filterAndCap's secondary-rank parameter (#6192)
fixed folder text outranking exact name matches, but scoreItem matches the
name or the secondary text, never the two together -- so a query spanning both,
like "leads emea" for a Leads table in EMEA, stopped matching anything.

Falls back to matching the joined text when neither field matches alone. That
runs last so a secondary hit still cannot masquerade as a name hit, keeping the
ranking #6192 established.
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Aug 2, 2026 7:11am

Request Review

@cursor

cursor Bot commented Aug 2, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Localized change to search-modal fuzzy scoring with regression tests; no auth, data, or API surface changes.

Overview
Restores Cmd-K search when a query spans the item name and folder path (e.g. leads emea for a Leads table under EMEA), which broke after name and secondary text were scored separately.

In scoreItem, after name-only and secondary-only fuzzyMatch attempts fail, it now falls back to matching name + extra joined—only as a last step so name hits still outrank folder-only hits. TSDoc notes that match positions from the joined string must not be used for highlighting.

Adds four tests for cross-field match, name-over-secondary ranking, secondary-only match, and no match.

Reviewed by Cursor Bugbot for commit f4683a4. Configure here.

@greptile-apps

greptile-apps Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR restores Cmd-K queries that span an item's primary name and secondary searchable text while retaining the existing preference for direct name matches.

  • Adds a final fuzzy-match attempt over the name and secondary text joined together.
  • Documents why joined-match positions must not be used for highlighting.
  • Adds regression coverage for cross-field matching, ranking, secondary-only matching, and non-matches.

Confidence Score: 5/5

The PR appears safe to merge, with the intended cross-field search behavior restored without weakening direct-name ranking.

The joined fallback runs only after both individual fields fail, absent secondary values remain protected by the existing guard, and match positions are discarded by the sole scoring consumer.

Important Files Changed

Filename Overview
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/utils.ts Adds a guarded joined-field fallback after name-only and secondary-only matching; no actionable defect was identified.
apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/search-modal/utils.test.ts Adds focused regression tests covering the intended cross-field behavior and preserved ranking semantics.

Reviews (1): Last reviewed commit: "fix(search): restore cross-field Cmd-K m..." | Re-trigger Greptile

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