Optimize note fetch in search

Avoids additional queries when finding notes