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

Search: always respect default pattern type#63410

Merged
jtibshirani merged 1 commit into
mainfrom
jtibs/patterntype
Jun 25, 2024
Merged

Search: always respect default pattern type#63410
jtibshirani merged 1 commit into
mainfrom
jtibs/patterntype

Conversation

@jtibshirani

@jtibshirani jtibshirani commented Jun 20, 2024

Copy link
Copy Markdown
Contributor

Previously, enabling then disabling the regexp toggle would always set the
patterntype to keyword, even when the user has set
search.defaultPatternType: standard. Now, toggles always revert back to the
default pattern type.

To support this, this PR adds defaultPatternType to the nav bar query state,
which is updated every time there's a settings update. Having
defaultPatternType available also lets us fix another bug: when
the default pattern type has been set to standard we no longer awkwardly show
patterntype: standard in the search bar. (This confusing behavior was
introduced recently in #63326.)

Overall, this PR set us up to remove experimentalFeatures.keywordSearch,
along with the keyword search toggle.
To opt out of keyword search, users can
just set search.defaultPatternType, and have it work everywhere.

Relates to SPLF-68

Test plan

Adapted unit tests. Lots of manual testing:

  • Set search.defaultPatternType: standard
    • Try every regexp and structural toggles
    • Try adding patterntype manually to URL and search bar
  • Reset default pattern type, and also test with experimentalFeatures.keywordSearch: false

@cla-bot cla-bot Bot added the cla-signed label Jun 20, 2024
@github-actions github-actions Bot added team/product-platform team/search-platform Issues owned by the search platform team labels Jun 20, 2024
@linear linear Bot mentioned this pull request Jun 20, 2024
4 tasks

@jtibshirani jtibshirani Jun 20, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here's the other important change, we now check the default before deciding whether to show the patterntype in the query,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Here is the most important change. The rest of the PR is prop drilling :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's helpful :-)

Comment thread client/web/src/util/settings.ts Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This part isn't strictly necessary, but seemed nice and made this PR easier to reason about.

@jtibshirani jtibshirani marked this pull request as ready for review June 20, 2024 22:33
@jtibshirani jtibshirani requested a review from a team June 20, 2024 22:33

@stefanhengl stefanhengl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@jtibshirani jtibshirani merged commit 37b6ded into main Jun 25, 2024
@jtibshirani jtibshirani deleted the jtibs/patterntype branch June 25, 2024 16:43
stefanhengl added a commit that referenced this pull request Jun 27, 2024
I noticed that the regexp toggle doesn't work anymore if `"search.defaultPatternType": "regexp"`. This is related to a recent change #63410.

We also append `patternType:keyword` in that case which I don't think we want, because we have an UI element to indicate that keyword search is active.

The question I don't know how to answer is: What should happen if `regexp` is the default and the user toggles keyword search off. Should we go back to `regexp` or to `standard`?

Test plan:
- new unit test
- manual testing with default pattern type set to "keyword" and "regexp".
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