Feature: Search As a user I want to search for resources in the space So that I can get them quickly Background: Given these users have been created with default attributes: | username | | Alice | | Brian | And using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "project101" with the default quota using the Graph API And user "Alice" has created a folder "folderMain/SubFolder1/subFOLDER2" in space "project101" And user "Alice" has uploaded a file inside space "project101" with content "some content" to "folderMain/SubFolder1/subFOLDER2/insideTheFolder.txt" @issue-10329 Scenario Outline: user can search items inside project space Given using DAV path And user "Alice" has created a folder "AlicePersonal" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "inside Alice personal space" to "AlicePersonal/insideAlicePersonal.txt" And user "Brian" has created a folder "BrianPersonal" in space "Personal" And user "Brian" has uploaded file with content "inside Brian personal space" to "BrianPersonal/insideBrianPersonal.txt" And user "Brian" has sent the following resource share invitation: | resource | BrianPersonal | | space | Personal | | sharee | Alice | | shareType | user | | permissionsRole | Viewer | When user "Alice" searches for "*inside*" inside space "project101" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | insideTheFolder.txt | But the search result of user "Alice" should not contain these entries: | insideAlicePersonal.txt | | insideBrianPersonal.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: user can search items inside personal space Given using DAV path And user "Alice" has created a folder "AlicePersonal" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "inside Alice personal space" to "AlicePersonal/insideAlicePersonal.txt" And user "Brian" has created a folder "BrianPersonal" in space "Personal" And user "Brian" has uploaded file with content "inside Brian personal space" to "BrianPersonal/insideBrianPersonal.txt" And user "Brian" has sent the following resource share invitation: | resource | BrianPersonal | | space | Personal | | sharee | Alice | | shareType | user | | permissionsRole | Viewer | When user "Alice" searches for "*inside*" inside space "Personal" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain only these entries: | insideAlicePersonal.txt | But the search result of user "Alice" should not contain these entries: | insideBrianPersonal.txt | | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | Scenario Outline: user cannot search items inside shares space Given using DAV path And user "Alice" has created a folder "AlicePersonal" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "inside Alice personal space" to "AlicePersonal/insideAlicePersonal.txt" And user "Brian" has created a folder "BrianPersonal" in space "Personal" And user "Brian" has uploaded file with content "inside Brian personal space" to "BrianPersonal/insideBrianPersonal.txt" And user "Brian" has sent the following resource share invitation: | resource | BrianPersonal | | space | Personal | | sharee | Alice | | shareType | user | | permissionsRole | Viewer | When user "Alice" searches for "*inside*" inside space "Shares" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries And the search result of user "Alice" should not contain these entries: | insideBrianPersonal.txt | | insideAlicePersonal.txt | | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: user can search hidden files Given using DAV path And user "Alice" has created a folder ".hidden" in space "project101" When user "Alice" searches for "*.hid*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | /.hidden | Examples: | dav-path-version | | old | | new | | spaces | Scenario Outline: user cannot search the .space folder of a space Given using DAV path And user "Alice" has created a folder ".space" in space "project101" When user "Alice" searches for "*.sp*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries Examples: | dav-path-version | | old | | new | | spaces | Scenario: user cannot search files inside the .space folder of a space Given using spaces DAV path And user "Alice" has created a folder ".space" in space "project101" And user "Alice" has uploaded a file inside space "project101" with content "hidden content" to ".space/spaceInternal.txt" When user "Alice" searches for "*spaceInternal*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries Scenario Outline: user cannot search pending share Given user "Brian" has disabled auto-accepting And using DAV path And user "Alice" has sent the following resource share invitation: | resource | folderMain | | space | project101 | | sharee | Brian | | shareType | user | | permissionsRole | Viewer | When user "Brian" searches for "*folder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries And the search result of user "Brian" should not contain these entries: | SubFolder1 | | subFOLDER2 | | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | Scenario Outline: user cannot search declined share Given using DAV path And user "Alice" has sent the following resource share invitation: | resource | folderMain | | space | project101 | | sharee | Brian | | shareType | user | | permissionsRole | Viewer | And user "Brian" has disabled sync of last shared resource When user "Brian" searches for "*folder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries And the search result of user "Brian" should not contain these entries: | SubFolder1 | | subFOLDER2 | | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | Scenario Outline: user cannot search deleted items Given using DAV path And user "Alice" has removed the folder "folderMain" from space "project101" When user "Alice" searches for "*folderMain*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario: user can search project space by name Given using spaces DAV path When user "Alice" searches for '*project101*' using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And for user "Alice" the search result should contain space "project101" @issue-10329 Scenario Outline: user can search inside folder in space Given using DAV path When user "Alice" searches for "*folder*" inside folder "/folderMain" in space "project101" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "3" entries And the search result of user "Alice" should contain only these entries: | SubFolder1 | | subFOLDER2 | | insideTheFolder.txt | But the search result of user "Alice" should not contain these entries: | folderMain | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: search inside folder in shares Given using DAV path And user "Alice" has sent the following resource share invitation: | resource | folderMain | | space | project101 | | sharee | Brian | | shareType | user | | permissionsRole | Viewer | When user "Brian" searches for "*folder*" inside folder "/folderMain" in space "Shares" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Brian" should contain only these entries: | SubFolder1 | | subFOLDER2 | | insideTheFolder.txt | But the search result of user "Brian" should not contain these entries: | /folderMain | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: search files inside the folder Given using DAV path And user "Alice" has uploaded file with content "hello world inside root" to "file1.txt" And user "Alice" has created folder "/Folder" And user "Alice" has uploaded file with content "hello world inside folder" to "/Folder/file2.txt" And user "Alice" has created folder "/Folder/SubFolder" And user "Alice" has uploaded file with content "hello world inside sub-folder" to "/Folder/SubFolder/file3.txt" When user "Alice" searches for "*file*" inside folder "/Folder" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain only these entries: | file2.txt | | file3.txt | But the search result of user "Alice" should not contain these entries: | file1.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-7114 @issue-10329 Scenario Outline: search files inside the folder with white space character in its name Given using DAV path And user "Alice" has created folder "/New Folder" And user "Alice" has uploaded file with content "hello world inside folder" to "/New Folder/file.txt" And user "Alice" has created folder "/New Folder/Sub Folder" And user "Alice" has uploaded file with content "hello world inside sub folder" to "/New Folder/Sub Folder/file1.txt" When user "Alice" searches for "*file*" inside folder "/New Folder" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain only these entries: | file.txt | | file1.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-7114 @issue-10329 Scenario Outline: search files with white space character in its name Given using DAV path And user "Alice" has created folder "/New Folder" And user "Alice" has uploaded file with content "hello world" to "/new file.txt" And user "Alice" has created folder "/New Folder/New Sub Folder" When user "Alice" searches for "*new*" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain only these entries: | New Folder | | New Sub Folder | | new file.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-enterprise-6000 @issue-7028 @issue-7092 @issue-10329 Scenario Outline: sharee cannot find resources that are not shared Given using DAV path And user "Alice" has created a folder "foo/sharedToBrian" in space "Personal" And user "Alice" has created a folder "sharedToCarol" in space "Personal" And user "Alice" has sent the following resource share invitation: | resource | foo | | space | Personal | | sharee | Brian | | shareType | user | | permissionsRole | Viewer | When user "Brian" searches for "shared*" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Brian" should contain these entries: | sharedToBrian | But the search result of user "Brian" should not contain these entries: | sharedToCarol | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: search resources using different search patterns (KQL feature) Given using spaces DAV path And user "Alice" has created a folder "subfolder" in space "project101" When user "Alice" searches for '' using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | | Examples: | pattern | search-result | description | | fold* | folderMain | starts with | | *der1 | SubFolder1 | ends with | | subfolder | subfolder | exact search | | name:*der2 | subFOLDER2 | patern 'name:'' | | name:"*der2" | subFOLDER2 | pattern 'name:""' (with quotes) | @issue-7812 @issue-8442 @issue-10329 Scenario Outline: try to search with invalid patterns Given using spaces DAV path And user "Alice" has uploaded file with content "test file" to "testFile.txt" When user "Alice" searches for "" using the WebDAV API Then the HTTP status code should be "400" And the value of the item "/d:error/s:message" in the response should be "error: bad request: the operator '' is missing an operand" Examples: | pattern | operator | | AND mediatype:document | AND | | alice NOT | NOT | @issue-10329 Scenario Outline: search a file globally (in all spaces) Given using DAV path And user "Alice" has created a folder "AlicePersonal" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "inside Alice personal space" to "AlicePersonal/insideAlicePersonal.txt" And user "Brian" has created a folder "BrianPersonal" in space "Personal" And user "Brian" has uploaded file with content "inside Brian personal space" to "BrianPersonal/insideBrianPersonal.txt" And user "Brian" has sent the following resource share invitation: | resource | BrianPersonal | | space | Personal | | sharee | Alice | | shareType | user | | permissionsRole | Viewer | When user "Alice" searches for "*inside*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "3" entries And the search result of user "Alice" should contain these entries: | insideAlicePersonal.txt | | insideTheFolder.txt | | insideBrianPersonal.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: search for files by extension Given using DAV path When user "Alice" searches for "*txt*" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain these entries: | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | Scenario Outline: search with empty field Given using DAV path When user "Alice" searches for "" using the WebDAV API Then the HTTP status code should be "400" Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: limit returned search entries to only 1 entry Given using DAV path When user "Alice" searches for "*folder*" and limits the results to "1" items using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain any "1" of these entries: | insideTheFolder.txt | | folderMain | | SubFolder1 | | subFOLDER2 | Examples: | dav-path-version | | old | | new | | spaces | @issue-10329 Scenario Outline: search for entry with emoji by pattern Given using DAV path And user "Alice" has uploaded file with content "hello world" to "upload😀 😁.txt" When user "Alice" searches for '"*😀 😁*"' using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain these entries: | upload😀 😁.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-3501 Scenario Outline: report extra properties in search entries for a file Given using DAV path When user "Alice" searches for "*insideTheFo*" using the WebDAV API requesting these properties: | oc:fileid | | oc:permissions | | d:getlastmodified | | d:getetag | | d:getcontenttype | | d:getcontentlength | Then the HTTP status code should be "207" And file "insideTheFolder.txt" in the search result of user "Alice" should contain these properties: | name | value | | oc:fileid | ^[0-9a-f-]+\$[0-9a-f-]+![0-9a-f-]+$ | | oc:permissions | ^(RDNVW\|RMDNVW)$ | | d:getlastmodified | ^[MTWFS][uedhfriatno]{2},\s(\d){2}\s[JFMAJSOND][anebrpyulgctov]{2}\s\d{4}\s\d{2}:\d{2}:\d{2} GMT$ | | d:getetag | ^\"[a-f0-9:\.]{1,32}\"$ | | d:getcontenttype | ^text\/plain$ | | d:getcontentlength | ^12$ | Examples: | dav-path-version | | old | | new | | spaces | @issue-3501 Scenario Outline: report extra properties in search entries for a folder Given using DAV path When user "Alice" searches for "*folderMain*" using the WebDAV API requesting these properties: | oc:fileid | | oc:permissions | | d:getlastmodified | | d:getetag | | d:getcontenttype | | oc:size | Then the HTTP status code should be "207" And folder "folderMain" in the search result of user "Alice" should contain these properties: | name | value | | oc:fileid | ^[0-9a-f-]+\$[0-9a-f-]+![0-9a-f-]+$ | | oc:permissions | ^(RDNVCK\|RMDNVCK)$ | | d:getlastmodified | ^[MTWFS][uedhfriatno]{2},\s(\d){2}\s[JFMAJSOND][anebrpyulgctov]{2}\s\d{4}\s\d{2}:\d{2}:\d{2} GMT$ | | d:getetag | ^\"[a-f0-9:\.]{1,32}\"$ | | oc:size | ^12$ | Examples: | dav-path-version | | old | | new | | spaces | @issue-internal-326 Scenario Outline: deleting a resource in one space does not remove identically-named paths from other spaces from the search index Given user "Alice" has created a folder "foo" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "alice content" to "foo/alice-file.txt" And user "Brian" has created a folder "foo" in space "Personal" And user "Brian" has uploaded a file inside space "Personal" with content "brian content" to "foo/brian-file.txt" And user "Brian" has removed the folder "foo" from space "Personal" And using DAV path When user "Alice" searches for "*file.txt*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | alice-file.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-internal-326 Scenario Outline: deleting a resource in one project space does not remove identically-named paths from other project spaces from the search index Given user "Alice" has created a space "project-1" with the default quota using the Graph API And user "Alice" has created a folder "folderMain/folder" in space "project-1" And user "Alice" has removed the folder "folderMain" from space "project-1" And using DAV path When user "Alice" searches for "*insideTheFolder*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | insideTheFolder.txt | Examples: | dav-path-version | | old | | new | | spaces | @issue-internal-326 Scenario: purging a trashed folder keeps an identically-named live folder at the same path in the search index Given using spaces DAV path And user "Alice" has created a folder "foo" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "trashed content" to "foo/trashed-file.txt" And user "Alice" has removed the folder "foo" from space "Personal" And user "Alice" has created a folder "foo" in space "Personal" And user "Alice" has uploaded a file inside space "Personal" with content "live content" to "foo/live-file.txt" And user "Alice" has deleted the folder with original path "foo" from the trashbin When user "Alice" searches for "*-file.txt*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | live-file.txt | But the search result of user "Alice" should not contain these entries: | trashed-file.txt | Scenario: searching for a folder after moving it in one space but not the other Given using spaces DAV path And user "Alice" has created a folder "foo" in space "Personal" And user "Brian" has created a folder "foo" in space "Personal" And user "Alice" has moved folder "foo" to "bar" in space "Personal" When user "Brian" searches for "*foo*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Brian" should contain these entries: | foo | Scenario: searching for a file after removing its folder in one space but not the other Given using spaces DAV path And user "Alice" has created a space "project-a" with the default quota using the Graph API And user "Alice" has created a space "project-b" with the default quota using the Graph API And user "Alice" has created a folder "foo" in space "project-a" And user "Alice" has created a folder "foo" in space "project-b" And user "Alice" has uploaded a file inside space "project-a" with content "a content" to "foo/file-a.txt" And user "Alice" has uploaded a file inside space "project-b" with content "b content" to "foo/file-b.txt" And user "Alice" has removed the folder "foo" from space "project-a" When user "Alice" searches for "*file*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "1" entries And the search result of user "Alice" should contain these entries: | file-b.txt | Scenario: a deleted space leaves the search index Given using spaces DAV path And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API And user "Alice" has created a space "index-space" with the default quota using the Graph API And user "Alice" has uploaded a file inside space "index-space" with content "some data" to "inSpace.txt" When user "Alice" searches for "*inSpace*" using the WebDAV API Then the HTTP status code should be "207" And the search result of user "Alice" should contain these entries: | inSpace.txt | When user "Alice" has disabled a space "index-space" And user "Alice" has deleted a space "index-space" And user "Alice" searches for "*inSpace*" using the WebDAV API Then the HTTP status code should be "207" And the search result should contain "0" entries