Sort office search newest-first and cap at 500 results#16
Conversation
Add <d:orderby> (getlastmodified descending) and <d:limit> to the WebDAV SEARCH so the server returns only the 500 most recently modified results. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Julius Knorr <jus@bitgrid.net>
eebf71f to
a099d35
Compare
|
/backport to stable34 |
|
@juliusknorr I'm not so familiar with the server, but does this not mean the frontend will not be aware of other files and therefore can't show a button to load more? office/src/views/OfficeOverview.vue Line 120 in adabbb1 |
|
@juliusknorr Is there some meta endpoint we can ping to get file count? |
|
I asked Claude: No — Nextcloud's DAVSEARCH doesn't support RFC 5323 aggregate COUNT, and there's no OCS endpoint for a mime-type file count either. The only way to know the true total is to fetch all The practical fix for hasMoreFiles is simpler: if the server returned exactly 500 results, assume there may be more and show a "showing newest 500" notice rather than trying to compute |
|
A fix Current (src/views/OfficeOverview.vue:119–120): const files = computed(() => filteredFiles.value.slice(0, MAX_DISPLAY_FILES))
const hasMoreFiles = computed(() => filteredFiles.value.length > MAX_DISPLAY_FILES)Fix: const files = computed(() => filteredFiles.value)
const hasMoreFiles = computed(() => allFiles.value.length >= MAX_DISPLAY_FILES) |
|
Ok, let me adjust, then we need to also pass the offset to the search request. |
Replace the body <d:limit> with Nextcloud's pagination headers (X-NC-Paginate / X-NC-Paginate-Count) and read X-NC-Paginate-Total so the UI knows whether more files exist than were returned. Drives hasMoreFiles from the real total instead of the display cap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds
<d:orderby>(getlastmodified descending) and<d:limit>(500) to the WebDAV SEARCH so the server returns only the 500 most recently modified office files. UI display cap raised to match.🤖 Generated with Claude Code