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

[feature/localsearch] Local account-wide search using custom queries #933

Merged
merged 42 commits into from
Apr 20, 2021

Conversation

felix-schwarz
Copy link
Contributor

@felix-schwarz felix-schwarz commented Mar 17, 2021

Description

Local account-wide search using custom queries. An arrow is added to the right of the search results to jump directly to the folder containing the results, scrolls the item into view and highlights it.

Local search segments the input into terms and filter keywords. Some examples:

Term Meaning
engineering find items with engineering in their name
engineering demos find items with engineering and demos in their name
"engineering demos" find items with engineering demos in their name
"engineering "demos find items with engineering and demos in their name
type:pdf limit search to items with a pdf suffix
type:pdf,mov limit search to items with a pdf or mov suffix
before:2021 limit search to last modified before 2021-01-01
before:2021-02 limit search to last modified before 2021-02-01
before:2021-02-03 limit search to last modified before 2021-02-03
after:2020 limit search to last modified after 2020-01-01
after:2020-02 limit search to last modified after 2020-02-01
after:2020-02-03 limit search to last modified after 2020-02-03
on:2020-02-03 limit search to last modified on 2020-02-03 (0h-24h)
on:2020-02-03,2020-02-05 limit search to last modified on 2020-02-03 (0-24h) or 2020-02-05 (0-24h)
smaller:200mb limit search to items smaller than 200 MB (supports tb / tib / gb / gib / mb / mib / b)
greater:1gb limit search to items greater than 1 GB (supports tb / tib / gb / gib / mb / mib / b)
owner:cscherm limit search to items owned by user cscherm
:file limit search to files
:folder limit search to folders
:image limit search to images (MIME type starting with image/)
:video limit search to videos (MIME type starting with video/)
:year limit search to items last modified since Jan 1st of the current year
:month limit search to items last modified since the current months's first day
:week limit search to items last modified since beginning of the current week's Monday
:today or :d limit search to items last modified on the current day
:5d limit search to items last modified in the last 5 days
:2w limit search to items last modified in the last 2 weeks
:1m limit search to items last modified this or last month
:m limit search to items last modified this month
:1y limit search to items last modified this or last year
:y limit search to items last modified this year
-[term] negates the search term, i.e. -:image to exclude images, or -wrd to exclude all matches containing wrd. This works with any of the examples above.

Other, related changes in this pull request:

  • database migrations with inline progress reporting
  • improved scene restoration (now also covering back to server list)

Other, unrelated changes in this pull request:

  • check if displayName and userName have at least one character before using them to build OCBookmark.shortName for displaying in the server list
  • more differentiated status 503 handling as described in https://github.com/owncloud/enterprise/issues/4476
  • sync status scrubbing: removes sync status from items with invalid sync status (from previous versions), avoiding items whose sync actions are fully processed from continuing to "spin" in the list

To Do

Related Issues

Screenshots (if appropriate):

Database upgrade / migration Search with Reveal buttons
Bildschirmfoto 2021-03-22 um 22 15 31 Bildschirmfoto 2021-03-24 um 23 53 25
Show more results (censored) Revealed/highlighted item
Bildschirmfoto 2021-03-25 um 10 37 36 Bildschirmfoto 2021-03-25 um 10 34 47

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

QA

Test Plan: https://github.com/owncloud/QA/blob/master/Mobile/iOS-app/Version%2011.6/Local%20search.md

Reports:

@CLAassistant
Copy link

CLAassistant commented Mar 17, 2021

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ hosy
❌ felix-schwarz
You have signed the CLA already but the status is still pending? Let us recheck it.

@felix-schwarz felix-schwarz changed the title [feature/localsearch] Local account-wide search using custom queries [feature/localsearch] Local account-wide search using custom queries [WIP] Mar 17, 2021
- replace all/folder text in scope selection with icons on iOS 13+
@felix-schwarz felix-schwarz added this to the 11.6.0-Current milestone Mar 17, 2021
	- turn localizedName from a function into a property
	- add sortPropertyName to simplify construction of custom OCQuerys
- ClientQueryViewController
	- add sort property, sort order and result limits to OCQueryCondition
	- refresh search query when changing sort order and peak results
… on a view

- ServerListTableViewController
	- add user activity to allow state restoring to server list (previously only *always* to the last opened bookmark)
	- remove auto login code for pre-iOS 13 (in iOS 13 that's handled by scene/state restoration)
	- add inline status reporting for database migrations
- SceneDelegate: add support to state restore to server list
- ClientQueryViewController
	- switch to search tokenizer to construct OCQueryCondition
	- make sure sort / search options are no longer hidden when showing large "No results" message
- ClientRootViewController
	- add support for migration progress reporting / OCCoreBusyStatusHandler passing
	- fix OCFileProviderServiceStandby leak if OCCoreManager returns a request with an error
- FileProvider extension
	- return an error when trying to access an account whose database needs migration
	- handle case where no OCCore is available
- MessageView: add option to show messages with insets at the edges
- NSDate+ComputedTimes:
	- simplified computation of beginning of days, weeks, months and years, with support for offsets
	- add unit test
- OCQueryCondition+SearchSegmenter:
	- segmentation of search queries into terms and "keywords"
	- supports placing terms in "" as well as unclosed "
	- keyword support to filter for:
		- files (:file), folders (:folder),
		- images (:image), video (:video)
		- time frames (:today, :week, :month, :year)
		- dynamic time frames (:7d, :2w, :1m, :1y, days:7, weeks:2, month:1, year:1, …)
		- file types/suffixes (type:jpg)
	- add unit test
…ing an item and then navigating back to search

- ClientQueryViewController: adapt to QueryFileListTableViewController changes
	- add navigationHandler property to allow custom navigation actions to get triggered by the breadcrumb view
- ClientItemCell
	- add reveal button support
- ClientQueryViewController / QueryFileListTableViewController
	- allow providing an item to reveal and highlight
	- allow specifying if bread crumbs should push new view controllers
	- show reveal arrows for custom queries
…ning

- use search term segmentation also for folder search (via OCQueryCondition+Item)
- add concept and property of activeQuery to QueryFileListTableViewController
- adopt activeQuery in ClientQueryViewController to prevent QueryFileListTableViewController from controlling the customSearchQuery / run into conflicts
- resolve issue where a "Stopped" status was displayed sometimes when returning from a revealed search result
	- add date parsing for strings following [year]-[[month][-[day]]] syntax
	- clarify all other method names
- NSString+ByteCountParser: parse strings into byte counts, support TB, TiB, GB, GiB, MB, MiB, B and bytes-without-B
- OCQueryCondition+SearchSegmenter
	- add support for localized keywords in local search
	- clean up keywords, removing kind-of-duplicates
	- add new keywords:
		- after: return items last modified after the given date
		- before: return items last modified before the given date
		- on: return items last modified on the given date
		- smaller: return items less than this size
		- greater: return items greater than this size
@felix-schwarz felix-schwarz changed the title [feature/localsearch] Local account-wide search using custom queries [WIP] [feature/localsearch] Local account-wide search using custom queries Mar 29, 2021
@felix-schwarz felix-schwarz requested a review from hosy March 29, 2021 23:07
@hosy
Copy link
Collaborator

hosy commented Mar 30, 2021

@felix-schwarz at first: thank you for implementing this helpful feature!
Could it make sense, if you add a help view, which is visible the first time the new search is used and show an explanation which keywords are available and how to use it?
Maybe it makes sense to have a generic class to show help content and remember, when it was shown.
Furthermore all available help topics should be available in the settings.

What do you think?

@hosy
Copy link
Collaborator

hosy commented Mar 30, 2021

Not sure if the UI refinement should be a part of a new issue. Here some ideas:

  • Search suggestions (instead of help view?)
  • Search tokens

image

image

@felix-schwarz
Copy link
Contributor Author

@hosy Thanks for the ideas and feedback. I like them a lot!

My plan is to implement search in two steps:

  • Step 1: pretty much this PR, to have search available quickly while also allowing to evaluate which keyword "power features" might be useful and needed.
  • Step 2: refactoring for simplicity, search, inline actions, suggestions and grid view:
    • introduce a new ClientItemSource class that provides a list of entries, with subclasses that
      • house just a list of OCItems
      • feed themselves from OCQuery
      • compose their own items from other ClientItemSources - for search maybe even leveraging OCExtension to create an extensible infrastructure
      • return ClientItems (not sure if a class or just a category), which can represent
        • classic OCItems
        • (new) actions (like the "Show more" entry in this PR)
        • (new) suggestions or search history (like in your suggestions)
    • refactor the ClientQueryViewController and parent classes back into a single, "simple" controller that takes its items from a new ClientItemSource object
    • a grid view implementation/replacement for ClientQueryViewController would also benefit from the simplicity of only having to handle a ClientItemSource

I think showing help is a good idea to make these features accessible, but I'd move that to step 2, where it's easier to determine what's still needed after f.ex. adding suggestions. One of the "suggestions" could, btw, also be a "link" that opens an "advanced search" UI, which provides a UI for the supported keywords, composing the keywords for them in the end.

ownCloudAppShared/Client/User Interface/SortBar.swift Outdated Show resolved Hide resolved
@@ -56,7 +88,7 @@ public class SortBar: UIView, Themeable, UIPopoverPresentationControllerDelegate
}

// MARK: - Constants
let sideButtonsSize: CGSize = CGSize(width: 44.0, height: 44.0)
let sideButtonsSize: CGSize = CGSize(width: 22.0, height: 22.0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought we set this to 44.0 before, because it was not so good to tap, because of the small size before. Please also have a look, if it is aligned with the of the more button in the file list cell. Before the UI looked a little bit "jumpy".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was also my worry initially, but it didn't seem to be an issue in tests when I tried. I chose a smaller size so that the "Reveal" arrow also fits in without excessive white space between the "more dots" and the "reveal" arrow.

In my testing, the dots still aligned well between navigation bar and table view rows:

More More + Reveal
Bildschirmfoto 2021-04-08 um 22 59 56 Bildschirmfoto 2021-04-08 um 23 00 26

Copy link
Collaborator

Choose a reason for hiding this comment

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

The problem is on a real device. On simulator everything works fine, but on the iPhone it is difficult to touch.


for scope in SearchScope.allCases {
if let image = scope.image {
searchScopeSegmentedControl.insertSegment(with: image, at: scope.rawValue, animated: false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does it make more sense to only show the titles? Your chosen images are great, but it looks a little bit to large for the small segmented control UI element. But needs to check, if the width fits for all UI elements in this row on a small iPhone display.
Can you try a build with titles only please?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did initially try with titles, but ran into space problems and had issues finding a short word that explains the purpose as well as the icons. "all" fits, but "everywhere" or "all folders" would be better. Same with "folder" vs. "this folder". But then the UI no longer fits.

If you feel the icons are too large, we could also try slightly scaled down versions. What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I just tested the label solution on a small screen size (iPhone 6) and it fits. I also discovered, that the Multiselect button needs to be hidden, when search is active, because the UI elements are hidden in this mode. This also give us more space for the search scope segmented control.
Maybe it makes sense to use the label Account instead of All for the global search scope.

If you agree, I can push my changes, but I'm also interested in your thoughts.
Here you can see the result:

Simulator Screen Shot - iPhone 6s - 2021-04-09 at 11 12 55

Copy link
Contributor Author

@felix-schwarz felix-schwarz Apr 9, 2021

Choose a reason for hiding this comment

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

Account and Folder are good choices for labels IMO.

My worry, however, is with iOS 12 on the smallest supported devices (iPhone 5s). Even in English, it's already getting really tight, but in German there are overlaps (notice the / next to the drop down label):

English German
Simulator Screen Shot - iPhone 5s - 2021-04-09 at 14 58 17 Simulator Screen Shot - iPhone 5s - 2021-04-09 at 15 04 08

Copy link
Contributor Author

@felix-schwarz felix-schwarz Apr 9, 2021

Choose a reason for hiding this comment

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

I also just noticed that we don't change the placeholder text when switching between account and folder scope (always "Search this folder"). Will fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the other hand, we can't use the SF Symbols on iOS 12, so would either need to provide our own icons - or drop back to text there. Taking into account that iOS 12 + iPhone 5s should be a really small cohort, the only issue for these is purely cosmetic in nature, and that text communicates the purpose a lot clearer, I came to the conclusion that we should indeed use text here and merged the changes from your branch.

Also fixed the placeholder text.

- add full localization + normalization of keywords
- add English and German localization
- remove leftover code
@felix-schwarz
Copy link
Contributor Author

felix-schwarz commented Apr 16, 2021

(9) Multiselect possible after search in directory picker [FIXED]

When searching in the directory picker (f.ex. during a Move action) and exiting from search, the otherwise unavailable multi select button appears and can be used.

…ect should be available, defaulting to true

- QueryFileListTableViewController, ClientQueryViewController: allow efficient subclassing of relevant parts of the reveal feature
- ClientDirectoryPickerViewController: provide implementations of relevant reveal subclassing points, disable multi-select (fixing finding (7) and (9) in #933)
@felix-schwarz
Copy link
Contributor Author

@hosy @jesmrec (7) and (9) are addressed by 4fddedf

@jesmrec
Copy link
Contributor

jesmrec commented Apr 16, 2021

Thanks for your help with the QA ;)

i keep checking

@jesmrec
Copy link
Contributor

jesmrec commented Apr 16, 2021

(1), (2), (4), (6), (7), (9) -> fixed

(3) -> not fixed. Sorting options are still alligned to the left.

(5) -> won't fix here

1st QA rond complete, will do a second round with iPad (including the (8) check)

- search segmenter: add support for owner keyword, incl. localization
@felix-schwarz
Copy link
Contributor Author

felix-schwarz commented Apr 16, 2021

I was also thinking about searching for users (owners, …). What do you think?

Yeah, I like owners 👍

@michaelstingl @jesmrec: As of 399ed6d, owner:[userID] is now supported.

@felix-schwarz
Copy link
Contributor Author

@jesmrec Re (3): please share a screenshot and mark what part exactly is misplaced. I thought it'd be about the "name | kind | size | …" part of the Sort Bar.

@jesmrec
Copy link
Contributor

jesmrec commented Apr 19, 2021

about (3): the sorting bar name | kind | size | date | shared is moved to the left side of the screen in landscape mode, if we compare it with the base branch (milestone/11.6)

Then, not a bad behaviour or a blocker, but a difference that can be intended or not (this is my question)

milestone/11.6 current
Screen Shot 2021-04-19 at 08 41 41 Screen Shot 2021-04-19 at 08 39 26

399ed6d

@jesmrec
Copy link
Contributor

jesmrec commented Apr 19, 2021

Checking (8). New shortcuts are correct, but i miss one: Change Sort Type/Order is now available in the folder picker but it's missing in the file list. @hosy, kind of regression?

@jesmrec
Copy link
Contributor

jesmrec commented Apr 19, 2021

OTOH, the maintenance error is not prevented correctly when an external storage is not accesible (showing cached content)

changed keyboard command for toggle search order and share item
@hosy
Copy link
Collaborator

hosy commented Apr 19, 2021

@jesmrec @felix-schwarz regarding (3):
for me the left aligned sort bar does also work, and maybe does make more sense, because it is also left aligned on the iPhone

regarding (8):
Fixed duplicated keyboard commands:
changed keyboard command for toggle search order and share item

@jesmrec
Copy link
Contributor

jesmrec commented Apr 20, 2021

regarding (8):
Fixed duplicated keyboard commands:
changed keyboard command for toggle search order and share item

fixed!!

@jesmrec @felix-schwarz regarding (3):
for me the left aligned sort bar does also work, and maybe does make more sense, because it is also left aligned on the iPhone

it is not a problem for me to keep the bar in the left-side. In terms of quality, it does not mean any loss. This is more UX-issue than quality issue.

@hosy
Copy link
Collaborator

hosy commented Apr 20, 2021

@jesmrec I think we should try the left aligned version. For me it fits into the current UI design. Most UI elements are left aligned and right aligned.

@jesmrec
Copy link
Contributor

jesmrec commented Apr 20, 2021

Ok, let's give a try. As i commented, i only reported this because is a non-reported difference with the base branch.

Then, QA is finished (test plan in first message) and no reports are pending

@jesmrec jesmrec added the Approved by QA Approved by QA label Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved by QA Approved by QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants