Search queries

This just adds the queries to save the searches in the db.