Codex

Function Reference/get search query

((Stub)) get_search_query() function is used to get query string when user does search on site. It really return query string rather than displaying query string as the_search_query() function.

Example: 2 lines below show search term but different usages.
<?php the_search_query(); ?>
OR
<?php echo get_search_query(); ?>