Here "He" refers to God. Here "hearts" is a metonym for a person's thoughts and emotions. The phrase "searches the hearts" is a metaphor for examining thoughts and emotions. AT: "God, who knows all our thoughts and feelings" (See: [[rc://en/ta/man/translate/figs-metonymy]] and [[rc://en/ta/man/translate/figs-metaphor]])