Fixing the search joins in note search query