refactored search.js and added book_spec test for query action