Added preprocess_search_result function