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

[Update] Improve Sample Viewer search #228

Merged
merged 34 commits into from
Aug 15, 2023

Conversation

CalebRas
Copy link
Collaborator

@CalebRas CalebRas commented Jul 20, 2023

Description

This PR updates the sample search bar in the Sample Viewer to include the searching of a sample's description and tags in addition to the name. Currently, the search bar performs a partial-text search on the names, a partial-text search on the descriptions, and a full-text search on the tags, in that order. The search results are divided into three sections, Name, Description, and Tags. Sections do not include samples that were found in a previous section, if any. Also, sections that have no results are hidden. If the search query is empty, a list of all the samples is displayed, sorted by name. Additionally, the query search text is bolded in the sample names and descriptions.

Linked Issue(s)

  • swift/issues/4230

How To Test

  • Tap on the search bar on the main screen
  • Enter a search query to see the results

Screenshots

Before After
Simulator Screen Shot - iPhone 14 Pro - 2023-07-20 at 09 39 50 Simulator Screen Shot - iPhone 14 Pro - 2023-07-20 at 11 45 48

To Discuss

A couple things to think about:

  • Is partial-text search for names, partial-text search for descirptions, and full-text search for tags okay?
  • Should sections include results that were found previous section?
  • Should sections with no results be hidden?
  • Should bold or highlighted text be used? (See [Update] Improve Sample Viewer search #228 (comment))
Bold (Markdown) Highlighted (AttributedString)
Bold Highlighted

@CalebRas CalebRas self-assigned this Jul 20, 2023
@CalebRas CalebRas requested a review from yo1995 July 20, 2023 17:05
Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

Haven't finished the review yet, here are some initial comments.

CalebRas and others added 2 commits August 2, 2023 09:31
Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

I'll take a look at the bold text method after these suggestions are addressed.

Shared/Supporting Files/Views/CategoryView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryView.swift Outdated Show resolved Hide resolved
@CalebRas CalebRas requested a review from yo1995 August 3, 2023 23:46
@yo1995 yo1995 requested a review from philium August 4, 2023 17:35
Copy link
Collaborator

@yo1995 yo1995 left a comment

Choose a reason for hiding this comment

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

Please make the bold method an private extension. I'll add Phil to review as well.

Scripts/GenerateSampleViewSourceCode.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryGridView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SampleListView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SampleListView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SampleListView.swift Outdated Show resolved Hide resolved
@yo1995
Copy link
Collaborator

yo1995 commented Aug 7, 2023

I'll assign this PR to myself and work on the feedback.

@yo1995 yo1995 assigned yo1995 and unassigned CalebRas Aug 7, 2023
@yo1995 yo1995 requested review from philium and removed request for philium August 8, 2023 21:07
Scripts/GenerateSampleViewSourceCode.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/ContentView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SampleRow.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SampleRow.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SearchResultView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SearchResultView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SearchResultView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/SearchResultView.swift Outdated Show resolved Hide resolved
Shared/Supporting Files/Views/CategoryGridView.swift Outdated Show resolved Hide resolved
yo1995 and others added 5 commits August 9, 2023 16:14
Co-authored-by: Philip Ridgeway <pridgeway@esri.com>
Use `symbolVariant` instead of ternary operator.

Co-authored-by: Philip Ridgeway <pridgeway@esri.com>
Only make the tags a set at the last step of code generation, so it keeps the order for the most part.

Co-authored-by: Philip Ridgeway <pridgeway@esri.com>
@yo1995 yo1995 requested a review from philium August 10, 2023 01:01
@yo1995 yo1995 mentioned this pull request Aug 11, 2023
@yo1995 yo1995 requested a review from philium August 11, 2023 21:59
@yo1995 yo1995 requested a review from dfeinzimer August 12, 2023 00:43
Copy link
Contributor

@dfeinzimer dfeinzimer left a comment

Choose a reason for hiding this comment

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

Just the one suggestion

@yo1995
Copy link
Collaborator

yo1995 commented Aug 15, 2023

Thanks for all your suggestions!

@yo1995 yo1995 merged commit 452c08e into v.next Aug 15, 2023
1 check passed
@yo1995 yo1995 deleted the Caleb/Update-SampleViewerSearchBar branch August 15, 2023 07:03
@yo1995
Copy link
Collaborator

yo1995 commented Aug 15, 2023

When I was closing the opened tabs, I found the searchScopes(_:scopes:) API which is useful for further improving the experience. Will log a card for iOS 16+ improvements.

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.

4 participants