Ok so I researched this a little bit more today on erased messages. I forgot when my dds doctors appt. was this week. I had texted if to her, but of course I deleted and so did she. I put the search bar to use. I type in her name and certain texts came up but nothing about the appointment. So I typed in the doctors name and I found out from a message I deleted.
It's based on what certain words are names you type in also. So when I said me, of course it brings up deleted text that have Me in them. So it also goes by words, names, etc.
hopefully I can figure more out as I stumble upon these features. Lol