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. Alternate translation: "God, who knows all our thoughts and feelings, knows" (See: [[rc://en/ta/man/jit/figs-metonymy]] and [[rc://en/ta/man/jit/figs-metaphor]])