We found a solution for this problem - you can add a label with a search box, that searches only within a certain course, using the follwoing html code:
<form class="search-input-form expanded" action="https://YOURMOODLEURL/search/index.php"><label for="id_q_XXXXX" class="accesshide">Search</label><input type="text" filter="course: coursename" name="q" placeholder="Search" size="13" tabindex="-1" id="id_q_XXXXX"
class="form-control">
<input type="hidden" name="context" value="2"> <input type="hidden" name="courseids" value="insert id-number of course">
</form>