When a statement in Velocity returns null, Velocity will output the statement itself. For example, if $searchResult.getProperty("Department") is not set (is null), the template will output $searchResult.getProperty("Department").

If you want to output "" (empty string) instead, you can specify the statement as $!statement. In the example, when the statement is changed to $!searchResult.getProperty("Department") (not the additional bang) and the property is not set, the template will output "" (empty string).

Displaying Extended User Details in the Search Results

Create a template file search-user.vm in the top level of the theme directory (read more about user search in the User Search Recipe):