Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(sanity): allow global search "contains" filter to match inside words #7572

Merged
merged 1 commit into from
Oct 2, 2024

Conversation

juice49
Copy link
Contributor

@juice49 juice49 commented Oct 2, 2024

Description

This branch adjusts the global search "contains" filter to allow matches inside words. Although this filter is named stringMatches internally, it is publicly named "contains", which suggests it should match inside words.

The match expression is wrapped in wildcard * operators to achieve this.

Example: searching for documents by title containing "blo"

Before After
Screenshot 2024-10-02 at 10 24 17 Screenshot 2024-10-02 at 10 25 11

What to review

  • Does this change make sense?
  • Do global searches using the "contains" filter still produce relevant results?

Testing

  • Updated unit tests in packages/sanity/src/core/studio/components/navbar/search/definitions/operators/stringOperators.test.ts.

Notes for release

  • The global search "contains" filter now matches inside words.

Copy link

vercel bot commented Oct 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
page-building-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 10:10am
performance-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 10:10am
test-compiled-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 10:10am
test-next-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 10:10am
test-studio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 2, 2024 10:10am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
studio-workshop ⬜️ Ignored (Inspect) Visit Preview Oct 2, 2024 10:10am

Copy link
Contributor

github-actions bot commented Oct 2, 2024

No changes to documentation

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Component Testing Report Updated Oct 2, 2024 10:12 AM (UTC)

✅ All Tests Passed -- expand for details
File Status Duration Passed Skipped Failed
comments/CommentInput.spec.tsx ✅ Passed (Inspect) 42s 15 0 0
formBuilder/ArrayInput.spec.tsx ✅ Passed (Inspect) 8s 3 0 0
formBuilder/inputs/PortableText/Annotations.spec.tsx ✅ Passed (Inspect) 30s 6 0 0
formBuilder/inputs/PortableText/copyPaste/CopyPaste.spec.tsx ✅ Passed (Inspect) 37s 11 7 0
formBuilder/inputs/PortableText/copyPaste/CopyPasteFields.spec.tsx ✅ Passed (Inspect) 0s 0 12 0
formBuilder/inputs/PortableText/Decorators.spec.tsx ✅ Passed (Inspect) 18s 6 0 0
formBuilder/inputs/PortableText/DisableFocusAndUnset.spec.tsx ✅ Passed (Inspect) 10s 3 0 0
formBuilder/inputs/PortableText/DragAndDrop.spec.tsx ✅ Passed (Inspect) 3m 0s 0 0 0
formBuilder/inputs/PortableText/FocusTracking.spec.tsx ✅ Passed (Inspect) 43s 15 0 0
formBuilder/inputs/PortableText/Input.spec.tsx ✅ Passed (Inspect) 1m 36s 21 0 0
formBuilder/inputs/PortableText/ObjectBlock.spec.tsx ✅ Passed (Inspect) 1m 14s 18 0 0
formBuilder/inputs/PortableText/PresenceCursors.spec.tsx ✅ Passed (Inspect) 9s 3 9 0
formBuilder/inputs/PortableText/RangeDecoration.spec.tsx ✅ Passed (Inspect) 26s 9 0 0
formBuilder/inputs/PortableText/Styles.spec.tsx ✅ Passed (Inspect) 17s 6 0 0
formBuilder/inputs/PortableText/Toolbar.spec.tsx ✅ Passed (Inspect) 35s 12 0 0
formBuilder/tree-editing/TreeEditing.spec.tsx ✅ Passed (Inspect) 0s 0 3 0
formBuilder/tree-editing/TreeEditingNestedObjects.spec.tsx ✅ Passed (Inspect) 0s 0 3 0

Copy link
Contributor

github-actions bot commented Oct 2, 2024

⚡️ Editor Performance Report

Updated Wed, 02 Oct 2024 10:18:40 GMT

Benchmark reference
latency of sanity@latest
experiment
latency of this branch
Δ (%)
latency difference
article (title) 16.7 efps (60ms) 15.9 efps (63ms) +3ms (+5.0%)
article (body) 53.6 efps (19ms) 53.3 efps (19ms) +0ms (+0.5%)
article (string inside object) 18.2 efps (55ms) 16.9 efps (59ms) +4ms (+7.3%)
article (string inside array) 14.1 efps (71ms) 13.3 efps (75ms) +4ms (+5.6%)
recipe (name) 29.9 efps (34ms) 30.8 efps (33ms) -1ms (-3.0%)
recipe (description) 34.5 efps (29ms) 34.5 efps (29ms) +0ms (-/-%)
recipe (instructions) 99.9+ efps (6ms) 99.9+ efps (6ms) +0ms (-/-%)
synthetic (title) 13.9 efps (72ms) 14.1 efps (71ms) -1ms (-1.4%)
synthetic (string inside object) 14.5 efps (69ms) 15.6 efps (64ms) -5ms (-7.2%)

efps — editor "frames per second". The number of updates assumed to be possible within a second.

Derived from input latency. efps = 1000 / input_latency

Detailed information

🏠 Reference result

The performance result of sanity@latest

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 60ms 68ms 100ms 162ms 1380ms 15.0s
article (body) 19ms 20ms 27ms 181ms 186ms 6.1s
article (string inside object) 55ms 60ms 72ms 201ms 1175ms 9.3s
article (string inside array) 71ms 77ms 96ms 204ms 2100ms 10.4s
recipe (name) 34ms 38ms 45ms 88ms 41ms 9.7s
recipe (description) 29ms 30ms 35ms 63ms 29ms 6.1s
recipe (instructions) 6ms 8ms 9ms 23ms 0ms 3.3s
synthetic (title) 72ms 76ms 87ms 236ms 2513ms 19.1s
synthetic (string inside object) 69ms 73ms 80ms 263ms 1920ms 10.4s

🧪 Experiment result

The performance result of this branch

Benchmark latency p75 p90 p99 blocking time test duration
article (title) 63ms 69ms 102ms 141ms 1415ms 15.8s
article (body) 19ms 22ms 29ms 220ms 332ms 6.4s
article (string inside object) 59ms 62ms 77ms 166ms 1269ms 9.4s
article (string inside array) 75ms 82ms 96ms 165ms 2169ms 10.9s
recipe (name) 33ms 35ms 43ms 84ms 66ms 10.0s
recipe (description) 29ms 31ms 37ms 177ms 49ms 6.5s
recipe (instructions) 6ms 8ms 9ms 10ms 0ms 3.3s
synthetic (title) 71ms 74ms 84ms 332ms 2211ms 18.4s
synthetic (string inside object) 64ms 67ms 77ms 271ms 1791ms 10.3s

📚 Glossary

column definitions

  • benchmark — the name of the test, e.g. "article", followed by the label of the field being measured, e.g. "(title)".
  • latency — the time between when a key was pressed and when it was rendered. derived from a set of samples. the median (p50) is shown to show the most common latency.
  • p75 — the 75th percentile of the input latency in the test run. 75% of the sampled inputs in this benchmark were processed faster than this value. this provides insight into the upper range of typical performance.
  • p90 — the 90th percentile of the input latency in the test run. 90% of the sampled inputs were faster than this. this metric helps identify slower interactions that occurred less frequently during the benchmark.
  • p99 — the 99th percentile of the input latency in the test run. only 1% of sampled inputs were slower than this. this represents the worst-case scenarios encountered during the benchmark, useful for identifying potential performance outliers.
  • blocking time — the total time during which the main thread was blocked, preventing user input and UI updates. this metric helps identify performance bottlenecks that may cause the interface to feel unresponsive.
  • test duration — how long the test run took to complete.

Copy link
Contributor

@pedrobonamin pedrobonamin left a comment

Choose a reason for hiding this comment

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

Looks good to me, tested it in the dev studio and it now returns accurate results. Thanks @juice49 !

@juice49 juice49 added this pull request to the merge queue Oct 2, 2024
Merged via the queue into next with commit e7e7185 Oct 2, 2024
51 checks passed
@juice49 juice49 deleted the fix/sdx-1632/global-search-contains-predicate branch October 2, 2024 13:16
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.

2 participants