Searching for content of specified path.

Copper Contributor

The issue;


Using Search Query from the top of a SharePoint site;

path:""https://contoso.sharepoint.com/teams/MyHubSite-Imagery/Renders/" (filetype:jpg OR filetype:png OR filetype:gif)

Or perhaps;
path:"https://contoso.sharepoint.com/teams/MySite-Imagery/Renders/"


Either of these return all stored pictures from the "Renders" Document Library.

But as the "Renders" Document Library contains many images, too many image matched search results are returned when searching the entire Document Library - making these broad queries rather undesirable to use as a search.

Knowing that each image is saved within its own project folder, we're looking for search techniques to refine the image search using the name of their directory.

But when we try the following search query;
path:"https://contoso.sharepoint.com/teams/MySite-Imagery/Renders/Example Project/"


The folder called "Example Project" is returned itself, but the image files within the folder "Example Project" do not return from the search query.

 

In the previous search of the entire Document Library, all of the contents of "Example Project" absolutely returned, but mixed in with the entire contents of that Document Library, it was an impracticable search to do, as it returns all images - but we couldn't help but note that the images that we were looking for were returned with the countless others. All we're needing is to refine the search down to that images sub-directory.

The image names themselves are random, unfortunately.

 

Has anyone any suggestions on how to structure a SharePoint Online search term that will find files within a directory of a Document Library?

Or are we facing an inevitable outcome of adding a Project Name column, and updating the metadata of each and every image file with its Project Name (the folder each image resides in), and then indexing that Project Name column?

3 Replies

@Karllight I just tested this on our SharePoint site and I am able to search for files within a specific folder using query like: 

 

path: "https://contoso.sharepoint.com/sites/SPConnect/Shared Documents/folder1"

 

Folder contents in library

ganeshsanap_0-1675934007177.png

Search Output

ganeshsanap_1-1675934179337.png


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

Hi @Karllight,

the "path" property works with subfolders in general

Document library with subfolder "Example Project" and even a subfolder
doclib2.png

Query

query.png

 

Results

search results.png

I think something else is the problem in your case...

Could you try uploading a brand new image into the "Example Projekt" folder?
Do you set other search settings?

Best Regards,
Sven

Best Regards,
Sven

Thank you kindly for your testing @SvenSieverding and @ganeshsanap

Your returned search results give me hope that this is indeed either a bug or a mis-configuration that we face, and not a product limitation.

What's strange is that I've done the same/similar query in two different tenants on different folder/file structures both of which returned the same problem. The target folder is returned from the search query but none of the files contained within.

Keen to hear suggestions as to what could be causing the difference in behaviours. I'm very keen to resolve this problem.