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 Aug 1, 2024
Merged
Conversation
Contributor
Author
a393408 to
555933d
Compare
jtibshirani
commented
Aug 1, 2024
| SearchTypeRegex SearchType = iota | ||
| SearchTypeLiteral | ||
| SearchTypeStructural | ||
| SearchTypeLucky |
Contributor
Author
There was a problem hiding this comment.
Note: I checked customer telemetry and saw 0 usages of the lucky patterntype.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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 usesm=1andpatterntype=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=1in 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.