def remove_non_name_matches(entries, query_obj):
    """Filter out Person entries if there is no overlap between names_prefixes
    and query_obj.query_words."""
    filtered_entries = []
    for entry in entries:
        for word in query_obj.query_words:
            if word in entry.names_prefixes:
                filtered_entries.append(entry)
                break
    return filtered_entries