Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat(search): remove smart search logic#64215

Merged
jtibshirani merged 2 commits intomainfrom
jtibs/smart-search
Aug 1, 2024
Merged

feat(search): remove smart search logic#64215
jtibshirani merged 2 commits intomainfrom
jtibs/smart-search

Conversation

@jtibshirani
Copy link
Contributor

@jtibshirani jtibshirani commented Aug 1, 2024

This change removes the backend smart search logic. After this, searches with smart search enabled (sm=1) will be executed in the default 'precise' mode (sm=0). For old searches that use sm=1 and patterntype=standard, it's possible that they will now return no results.

Looking at telemetry, only 0.1% of searches on dot com trigger any smart search rule. So this change should only affect a small percentage of usage. To mitigate the impact on these rare cases, this PR adds an alert whenever there are no results and smart search is enabled, suggesting users switch to keyword search. (This will help in the majority of cases, since the most frequent smart search rule rewrites literal queries to use 'AND' between terms).

Closes SPLF-92

Test plan

Covered by existing tests. Manually tested searches with sm=1 in URL.

Changelog

Smart search is no longer supported in the Sourcegraph backend. Old searches that specify 'smart search' mode will be run in the default 'precise' mode. If your query now doesn't behave as expected, you can update it to use the new patterntype:keyword.

@cla-bot cla-bot bot added the cla-signed label Aug 1, 2024
@github-actions github-actions bot added team/product-platform team/search-platform Issues owned by the search platform team labels Aug 1, 2024
@jtibshirani
Copy link
Contributor Author

Here's what the alert looks like. I decided not to mention "Smart Search" because I thought that would be more confusing than helpful (users might not even remember what "smart search" was and not realize why it's enabled).

Screenshot 2024-08-01 at 4 27 56 PM

@jtibshirani jtibshirani requested a review from a team August 1, 2024 13:30
Copy link
Member

@stefanhengl stefanhengl left a comment

Choose a reason for hiding this comment

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

Nice cleanup!

SearchTypeRegex SearchType = iota
SearchTypeLiteral
SearchTypeStructural
SearchTypeLucky
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I checked customer telemetry and saw 0 usages of the lucky patterntype.

@jtibshirani jtibshirani merged commit 5c5ed6c into main Aug 1, 2024
@jtibshirani jtibshirani deleted the jtibs/smart-search branch August 1, 2024 15:02
jtibshirani added a commit that referenced this pull request Aug 6, 2024
In #64215, we removed support for smart search. We continued to allow
the `smart` search mode, but just execute with `precise` behavior.
However, we started to throw an error for `patterntype:lucky` (which is
the old way of specifying smart search). It turns out that `lucky` made
its way into some search links and settings, causing those searches to
fail.

This PR restores support for `lucky`, and remaps it to `standard`. This
preserves the semantics as much as possible (since smart search attempts
a 'standard' search as its first rule).

Closes SRCH-840
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/product-platform team/search-platform Issues owned by the search platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants