Search API based on webDAV report#31873
Conversation
DeepDiver1975
left a comment
There was a problem hiding this comment.
looks good over app - please add tests- THX
| $this->server->on('report', [$this, 'onReport']); | ||
| } | ||
|
|
||
| /** |
There was a problem hiding this comment.
Looks like this slipped by... I'll fix this during the squash
|
|
||
| /** | ||
| * @param string $filesUri the base uri for this user's files directory, usually /files/username | ||
| * @param \OC\Search\Result\File[] $searchResults the results coming from the search service, within the files app |
There was a problem hiding this comment.
add use statement - 80 chars per line please
| $limit = $searchInfo['limit']; | ||
| } | ||
|
|
||
| $searchResults = $this->searchService->searchPaged($searchInfo['pattern'], ['files'], 1, $limit); |
There was a problem hiding this comment.
is 1 page one ? strange that it doesn't start at zero...
There was a problem hiding this comment.
According to the phpdocs in the function, it starts at 1. The default value is also 1. 🤷♂️
| */ | ||
| private function getSearchResultIterator($filesUri, $searchResults, $requestedProps) { | ||
| $paths = \array_map(function ($searchResult) use ($filesUri) { | ||
| return $filesUri . $searchResult->path; |
There was a problem hiding this comment.
sad that the search result doesn't contain node ids as it would spare us a step
but for the sake of "keep it simple" and not touching too many things, this is ok
There was a problem hiding this comment.
I'd vote for a new API for searches. Something that needs to be planned in any case.
Codecov Report
@@ Coverage Diff @@
## master #31873 +/- ##
============================================
+ Coverage 63.44% 63.45% +0.01%
- Complexity 18502 18523 +21
============================================
Files 1165 1167 +2
Lines 69410 69499 +89
Branches 1264 1264
============================================
+ Hits 44039 44104 +65
- Misses 25002 25026 +24
Partials 369 369
Continue to review full report at Codecov.
|
|
squashed (with minor fixes) |
|
@jvillafanez please backport |
|
Backport PR #31946 has been merged. |
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
This relates to owncloud/core#31873 and documents the search-files report of ownCloud's Search API.
Description
Add support to search files through webDAV
Related Issue
#25373
Motivation and Context
Allow search file using the REPORT webDAV method. The request must be made to the base of the user's directory for files, usually "/remote.php/webdav/" or "/remote.php/dav/files/myuser/". Trying to search in inner directories will return an NotImplemented exception.
The minimum xml body request is:
The base xml body request must be:
The list of properties can be adjusted to get what you need as any PROPFIND request.
The base search limit is hardcoded to 30 results if no explicit limit is set in the request.
How Has This Been Tested?
Manually tested
Screenshots (if appropriate):
Types of changes
Checklist: