When an external drive is used as a Time Machine Backup Disk, the files store in the drive are not indexed by Spotlight.

One possible solution is to create an APFS volume to store the files. But for some reasons, Spotlight does not index these files.

The working solution is to use an APFS volume for Time Machine Backup Disk, instead of the root volume. The other files can be stored in the root volume, or another APFS volume. These files are indexed by Spotlight.