Roger Blunden wrote: I have my Photos app set up so that file names are displayed under each photo when I am viewing the entire library.
First, we need to use the same names. Because, actually, Photos doesn't display file names. It displays Titles, and those are two different things. By "set up," do you mean that in View>Metadata you have Titles checked?

In the Info Window

the title is the first field, and the file name is the second field. In the absence of a title, Photos will show the filename, but the file name will be in gray rather than brighter white for titles.
Now, to answer your question:
However, once I do a search to view just a subset of the photos, the file name disappears.
As you say, if you use the general search field at the top right of the Photos window, then the results are shown without metadata. This search field is just for quick cursory looks. For serious searching, we use Smart Albums, like this:

This Smart Album is named temp, and I keep it handy for temporary searches. I have lots more for specific use.
Here, I've searched for pictures that have "thanksgiving" in the title, though I could have used filename or any of the other choices you see. I can also add more criteria, like capture date, for a stronger search.
The point is that with a Smart Album search, the Title/filename shows under the thumbnails.
Is this what you need?