Added logic for searching the fields

Added logic for searching the fields