How can display "Showing search results for : ' search String' " in Smart Search Results webpart

kumar GANJI asked on September 21, 2021 05:43

I am using Smart Search and Smart Search Results to Search and display the search Results. I want to display "Search String for which the search has been done". How can I get this value in Smart Search Result.

Correct Answer

Juraj Ondrus answered on September 21, 2021 08:33

By default, the search term is passed to the results web part through the URL query string parameter, e.g. ?searchtext=searchTerm. So, you can use query string macros and read this value, just be careful for SQLi and security. For example, three different ways of achieving the same:
1. {%searchtext%}
2. {%QueryString.searchtext%}
3. {%QueryString["parameter"]%}

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.