Use the -F
option to less
.
gawk -v RS="${recordSetDelimiter}" "BEGIN{IGNORECASE=$ignoreCase} /${searchTerm}/{print FILENAME ORS \$0 ORS \"<<\"}" "${directory}"/*.idx |
less -F -I -p "${searchTermLess}"
This makes it exit immediately if the output would fit on one screen, which is trivially true if there's no output.