Why do you need a function which would re-render accordeon? Accordeon generation does lots of "uneasy" and "expensive" dom manipulations in order to be generated. In your code you would re-generate accordeon again and again and again with every key stroke.

Why not to apply a class or a direct styling display:none to elements which do not comply with the search?

Also as a consequence of this coding - if you open one of the courses and then keyboard navigate to the search box; then move cursor anywhere else and you see how your accordeon would be re-generated causing an open course to collapse.