Fixes input to build_mongo_pages_query in /search route.