Add basic search functionality for posts and users and refactor models

Code is refactored so models have methods for getting the corresponding
resource path instead of using constants