Skip to content

Disable AI search when literal search finds no matches#2444

Open
Mbeaulne wants to merge 1 commit into
06-18-fix_search_input_lagfrom
06-22-fix-ai-search-no-results-fallback
Open

Disable AI search when literal search finds no matches#2444
Mbeaulne wants to merge 1 commit into
06-18-fix_search_input_lagfrom
06-22-fix-ai-search-no-results-fallback

Conversation

@Mbeaulne

@Mbeaulne Mbeaulne commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Description

AI search is now disabled when a literal (lexical) search returns no matches. Previously, when no lexical hits were found, AI search would fall back to a sampled "browse pool" built by evenly sampling the full component index, allowing the AI reranker to run against a representative spread of components. This behavior has been removed — if the query doesn't match anything lexically, the AI search button is disabled and the reranker is not called.

This removes the sampleEvenly utility function and the indexEntryToLexicalMatch fallback path from the Dashboard view, and updates buildAiCandidateMatches to return an empty array immediately when lexical search finds nothing.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

Test Instructions

  1. Open the Dashboard components view with AI search configured.
  2. Enter a query that has no lexical matches (e.g., a nonsense string like qqzznomatch).
  3. Confirm the "AI search" button is disabled and clicking it does not trigger a rerank call.
  4. Enter a query that does have lexical matches and confirm AI search remains functional.

Additional Comments

The previous browse-pool fallback was intended to give the AI model a representative sample when literal search found nothing. This PR removes that behavior, meaning AI search is only available as a refinement step when there are already some lexical candidates to rerank.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 06-22-fix-ai-search-no-results-fallback/83db60e

Mbeaulne commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Mbeaulne Mbeaulne changed the title fix-ai-search-no-results-fallback Disable AI search when literal search finds no matches Jun 22, 2026
@Mbeaulne Mbeaulne marked this pull request as ready for review June 22, 2026 18:37
@Mbeaulne Mbeaulne requested a review from a team as a code owner June 22, 2026 18:37
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from e9108d2 to c7568e5 Compare June 22, 2026 18:56
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch 2 times, most recently from b7cf8df to bcaf99b Compare June 22, 2026 19:19
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from c7568e5 to 31a98f5 Compare June 22, 2026 19:19
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch from bcaf99b to 23f25da Compare June 22, 2026 19:32
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from 31a98f5 to 48a85e6 Compare June 22, 2026 19:32
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch from 23f25da to b790697 Compare June 22, 2026 19:58
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from 48a85e6 to 9b93dc2 Compare June 22, 2026 19:58
Comment thread src/routes/v2/pages/Editor/components/componentSearchV2Logic.ts
Comment thread src/routes/Dashboard/DashboardComponentsV2View.tsx
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from 9b93dc2 to 7b2b03a Compare June 24, 2026 18:11
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch from b790697 to 149103e Compare June 24, 2026 18:11
@Mbeaulne Mbeaulne requested a review from camielvs June 24, 2026 18:20
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from 7b2b03a to 821d21a Compare June 24, 2026 19:52
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch from 149103e to 79faaaa Compare June 24, 2026 19:52
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from 821d21a to dc3ad56 Compare June 25, 2026 15:55
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch 2 times, most recently from a6ad948 to ca20ec6 Compare June 25, 2026 19:38
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from dc3ad56 to d4954c6 Compare June 25, 2026 19:38
@Mbeaulne Mbeaulne force-pushed the 06-22-fix-ai-search-no-results-fallback branch from d4954c6 to 83db60e Compare June 25, 2026 19:43
@Mbeaulne Mbeaulne force-pushed the 06-18-fix_search_input_lag branch from ca20ec6 to 609edda Compare June 25, 2026 19:43
Comment thread src/routes/v2/pages/Editor/hooks/useComponentSearchV2State.ts
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.

3 participants