upgraded the search code in the materials controller