set the search parameter foreign key BEFORE saving.