通过PHP进行Windows索引搜索不会返回图像

I'm using Windows Indexing search together with PHP to search inside thousands of files.

I got it working by using the PHP COM class.

But the problem is that the search result only return found txt, docx, pdf and document types of files. It doesn't return images or videos no matter what properties I tried searching.

When I search for 001 as the string:

actual result: y:/sample001.txt, y:/book001.pdf

Expect to also see: y:/picture001.jpg

But the result doesn't show jpg or any other types of media files.

Why did it not search for images (or videos)?

Thanks in advance for any help.

<?php # searchfunction.php

function comsearch($string){
    $path = "file:y:/";
    $conn = new COM("ADODB.Connection") or die("Cannot start ADO");
    $recordset = new COM("ADODB.Recordset");

    //setting the limit for the query
    $recordset->MaxRecords = 1000;

    $conn->Open("Provider=Search.CollatorDSO;Extended Properties='Application=Windows';");

    //creating the query against windows search indexer database.
    //we specify the path and the string we are looking for

    $recordset->Open("SELECT System.FileName, System.ItemPathDisplay, System.FileExtension FROM SYSTEMINDEX WHERE SCOPE='".$path."' AND CONTAINS('".$string."') AND System.FileExtension='.jpg'", $conn);

    if(!$recordset->EOF){
        $recordset->MoveFirst();
    }
    $files = array();
    while(!$recordset->EOF) {

        $filename = $recordset->Fields->Item("System.FileName")->value;

        $files[]=  $filename;
        $recordset->MoveNext();
    }

    return $files;
}
?>

The code above returns nothing at all with the condition System.FileExtension='.jpg' even when I have thousands of .jpg in my directory.

But when I try it without this condition, the result successfully returns txt, pdf and other document types of files in the same directory.

What did I do wrong?