feat(recent-files): allow grouping search results by mime type - #61164
Open
cristianscheid wants to merge 1 commit into
Open
feat(recent-files): allow grouping search results by mime type#61164cristianscheid wants to merge 1 commit into
cristianscheid wants to merge 1 commit into
Conversation
cristianscheid
force-pushed
the
feat/noid/recent-mime-type-grouping
branch
2 times, most recently
from
June 15, 2026 20:25
48bfb57 to
771d97c
Compare
cristianscheid
force-pushed
the
feat/noid/recent-mime-type-grouping
branch
2 times, most recently
from
July 14, 2026 14:27
c2170cb to
771020b
Compare
cristianscheid
force-pushed
the
feat/noid/recent-mime-type-grouping
branch
from
August 5, 2026 10:28
771020b to
da069ff
Compare
cristianscheid
marked this pull request as ready for review
August 5, 2026 10:58
cristianscheid
requested review from
Altahrim,
come-nc,
provokateurin and
salmart-dev
and removed request for
a team
August 5, 2026 10:58
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
cristianscheid
force-pushed
the
feat/noid/recent-mime-type-grouping
branch
from
August 5, 2026 12:31
da069ff to
5d82cff
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Introduces file grouping logic on the backend for the
SEARCH remote.php/davendpoint. When enabled, files of certain MIME types (configurable) that were uploaded/created/modified close together in time are returned with a<nc:mime_type_group>prop containing the group they belong to.Behavior
When
group_recent_filesis enabled and<nc:mime_type_group>is requested, grouping is applied to the results. Each group is represented by an integer and returned inside the<nc:mime_type_group>prop.<nc:mime_type_group>is returned as404:See the test scenario below for more details.
Test scenario
Configs were set like below:
occ config:app:set files group_recent_files --value=true occ config:app:set files recent_files_group_mime_types --value='["image/avif","image/gif","image/heic","image/heif","image/jpeg","image/jpg","image/jxl","image/png","image/tiff","image/webp"]' occ config:app:set files recent_files_group_same_folder_only --value=true occ config:app:set files recent_files_group_min_group_size --value=2 occ config:app:set files recent_files_group_timespan_minutes --value=2 occ config:app:set files recent_files_group_collapsed_items_limit --value=25group_recent_files- enables/disables file groupingrecent_files_group_mime_types- MIME types eligible for groupingrecent_files_group_same_folder_only- whether files must be in the same folder to be grouped togetherrecent_files_group_min_group_size- minimum number of files needed to form a grouprecent_files_group_timespan_minutes- maximum time gap between consecutive items for them to be grouped togetherrecent_files_group_collapsed_items_limit- maximum number of collapsed items the response should contain; a "collapsed item" considers each group as a single item, regardless of how many files it containsWith the config above, files were uploaded as follows:
img_1.jpgandimg_2.jpgat minute 6json_3.jsonandimg_4.jpgat minutes 9 and 10, respectivelyimg_5.jpgandimg_6.jpgat minute 14img_7.jpgandimg_8.jpgat minute 17The time used for sorting/grouping is
<nc:last_activity>, which representsmax($uploadTime, $creationTime, $lastModified). In this scenario, upload time is the max for all files.For grouping to work correctly, the request must order by
<nc:last_activity>descending:This returns results from most to least recent, meaning each item's
<nc:last_activity>is greater than or equal to the next item's.Grouping logic
For each item, in order:
recent_files_group_timespan_minutes):recent_files_group_same_folder_onlyis enabled and any of the following items in the time window is from a different folder, the window is also "contaminated" and no group is assignedrecent_files_group_min_group_size, no group is assigned eitherExtra fetches
Each fetch is capped by the request's
<d:limit>(defaulting to 100 if not set). If a single fetch doesn't return enough collapsed items to reachrecent_files_group_collapsed_items_limit, additional fetches are made until it does or until there are no more items to fetch (a limit of 5 extra fetches was set as a safety cap).Using the scenario above (
recent_files_group_collapsed_items_limit= 25), requesting with:returns 5 raw items on the first fetch, but fewer than 25 collapsed items, since
img_7.jpg/img_8.jpgandimg_5.jpg/img_6.jpgeach count as one group. So another fetch is made to attempt to reach the configured value.Additionally, if a page ends on a groupable node, one more fetch is made to check whether the group continues on the next page. This avoids splitting a group across two pages.
Test result
Given the scenario above, results are returned and grouped as:
img_7.jpg,img_8.jpgimg_5.jpg,img_6.jpgimg_4.jpgjson_3.json) is non-groupablejson_3.jsonimg_1.jpg,img_2.jpgResult of request/response can be seen below:
Checklist
3. to review, feature component)stable32)AI (if applicable)