Open michaelstingl opened 1 year ago
Learnings from https://github.com/owncloud/ios-app/pull/1142 that might help with this feature:
When a user enters a search term, it is processed in several steps. By example, based on :today cupola
(search files with "cupola" in the name, last modified today):
:today cupola
into [":today", "cupola"]
:today
and normalizes them into the English form, f.ex. :heute
is turned into :today
.:today
is turned into a search element filtering for the current day, f.ex. lastModified >= "2022-09-27 00:00:00", lastModified < "2022-09-28 00:00:00"
cupola
is turned into a search element filtering for the file name: fileName contains cupola
:today
is turned into [ iconName: "clock", localizedDescription: "heute" ]
originalSearchTerm
)The Search Elements coming from Parsing allow usage in different contexts:
iconName
and localizedDescription
are used for:
iconName
and localizedDescription
are equal, so is the criteria they search for, regardless of how it was initially expressed (f.ex. :today
could also be expressed as :0d
(since zero days)). This is useful to f.ex. determine which search filters should be shown as selected in the UI.SELECT
only matching itemsoriginalSearchTerm
s from the Search Elements as a string:today
can be parsed into a Search Element, whose iconName and localizedName can then be used to create a menu element the user can select to add that term to the searchSaved searches are stored in records with the following fields:
uuid
: random UUID generated on object creation, used for referencing a specific saved search (f.ex. for storage, applying and deletion)name
: (optional) name given by the usertype
: either template
or view
(see below)seachTerm
: containing the unparsed or re-joined (see above) search term entered by the userscope
: the scope of the search:
folder
: search only items in the current folder (non-hierarchic)tree
: search only items in the current folder and its subfolders (hierarchic)drive
: search only items in the current spaceaccount
: search items in the entire account / all "mounted" spaceslocation
: where a search was started, described as (only for view
s):
driveID
: the space's drive ID (only for folder
, tree
, drive
scopes)path
: the path inside the drive (only for folder
, tree
scopes)The searchTerm
is stored as a simple string because that makes it portable and ensures that :today
always means the current day, not the day the search was saved (as would happen when saving the Search Elements, as :today
is parsed into f.ex. lastModified >= "2022-09-27 00:00:00", lastModified < "2022-09-28 00:00:00"`).
Search templates: save only the searchTerm
and scope
, but not the location
. They can be selected only in the context of the search field and allow to apply the same set of search filters to different locations. If I f.ex. want to find only files last modified today, I could save a template for :file :today
- and then re-apply the same search + scope in a different folder.
Search views: save the full set of information, allowing to create a "smart view" of a set of items determined by logical criteria and not (necessarily) location. If someone wanted to have a view of all pdfs last modified in the current week in the Accounting
space, they could create a search view with scope = "drive", location.drive = "ae57q…", searchTerm = ":week :pdf"
.
A list of supported search expressions by the iOS app is part of https://github.com/owncloud/ios-app/pull/1142.
An API could offer four endpoints:
add
: for adding a saved search (based on the format outlined in Persistence
)edit
: for replacing a saved search with another one, based on the UUIDdelete
: for deleting a saved search, identified by its UUIDlist
: returns a list of saved searchesThis issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.
Is your feature request related to a problem? Please describe.
ownCloud iOS app 12.0+ comes with a very fancy search feature:
Users can combine multiple search parameters, then save this search to access it later again.
It would be super-awesome, if users could see the same search results as a shortcut in other clients, for example in the left sidebar in ownCloud web. (https://github.com/owncloud/web/issues/7691)
Describe the solution you'd like
oCIS would need to provide a new API/endpoint, where such search queries could be saved and accessed from all clients. (per-user)
Describe alternatives you've considered
File-based approach inside the WebDAV tree: iOS app could upload a hidden JSON file in a hidden
.search
folder.Additional context
See screenshots and example search queries in https://github.com/owncloud/ios-app/pull/1142