feat(recent-files): allow grouping search results by mime type - #61164
Draft
cristianscheid wants to merge 1 commit into
Draft
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
from
July 14, 2026 14:15
771d97c to
c2170cb
Compare
Signed-off-by: Cristian Scheid <cristianscheid@gmail.com>
cristianscheid
force-pushed
the
feat/noid/recent-mime-type-grouping
branch
from
July 14, 2026 14:27
c2170cb to
771020b
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_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=5group_recent_files- enables/disables file groupingrecent_files_group_mime_types- MIME types eligible for groupingrecent_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). If any of them is non-groupable, the window is "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 (a limit of 5 extra fetches was set as a safety cap).Using the scenario above (
recent_files_group_collapsed_items_limit= 5), requesting with:returns 5 raw items on the first fetch, but fewer than 5 collapsed items, since
img_7.jpg/img_8.jpgandimg_5.jpg/img_6.jpgeach count as one group. So another fetch is made 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:
TODO
Checklist
3. to review, feature component)stable32)AI (if applicable)