Textual and Visual Information Retrieval using Query Refinement and Pattern Analysis