Forum Discussion

David_Elsner's avatar
David_Elsner
Copper Contributor
Nov 29, 2024

Pictures and Videos are not treated as "Documents" in Search IsDocument:true

I have the need to search for all Files in a SharePoint Library (or globally).

To do this I use the following KQL: IsDocument:true

This works not for images. They do not seem to be "documents" in SharePoint.
Whenever I search a library for IsDocument:true, I receive PDFs, Excel sheets, other office formats, but no pictures.

Whenever I search for IsDocument:false, I get also the pictures from the list.


This seems to be very strange to me. Any ideas how to change this behavior?

3 Replies

  • michalkornet's avatar
    michalkornet
    Iron Contributor

    Hi, I simply checked the options provided in the Highlighted Content web part (which uses SP Serach). From all the options, only Documents, Images, and Videos seem to be files. But as you said, it’s a pity that IsDocument:true does not include Videos and Images as well.

     

  • michalkornet's avatar
    michalkornet
    Iron Contributor

    David_Elsner 

    Hi, it makes sense to separate documents from videos and images, as they behave slightly differently in SharePoint. You can extend your KQL query with the following text to get more results:

    For Images: ((FileType=gif OR FileType=jpg OR FileType=jpeg OR FileType=bmp OR FileType=dib OR FileType=tif OR FileType=tiff OR FileType=ico OR FileType=png OR FileType=jxr OR FileType=svg))


    For Videos: (FileType:3gp OR FileType:asf OR FileType:avi OR FileType:mkv OR FileType:mod OR FileType:mov OR FileType:mp4 OR FileType:m4v OR FileType:mpeg OR FileType:mpg OR FileType:mts OR FileType:ts OR FileType:vob OR FileType:wmv OR FileType:webm)


    You can also try filtering data by ContentType, but I believe the previous method should include all the missing files.

    • David_Elsner's avatar
      David_Elsner
      Copper Contributor

      Thanks,

      But I would like to have a query what returns all files (no folders)
      I thought that IsDocument:true is a query that returns all files, but it seems I was wrong?

      The pictures and videos where just an example - so your approach will work for them but maybe later I encounter other files that are also not treated as "Documents"?
      How can I be sure to return everything that is a file?

Resources