Building excerpts is the slowest part of the Relevanssi search, but 20 seconds is excessive, and tells something’s wrong.
A) How many posts does the search return? If it returns plenty, doing excerpts to many posts will take longer than doing excerpts for a smaller number of posts, so can you reduce the number of posts in the results?
B) Are you using words for determining the excerpt length, or characters? If you’re using characters, that’s much slower than using words, so use words.
C) Are your posts very long? Relevanssi tries to optimize the excerpt-building and only creates 200 possible excerpts per post. You can try optimizing the process with add_filter( 'relevanssi_optimize_excerpts', '__return_true' );
or you can use the relevanssi_excerpt_gap
filter hook to adjust this process to create fewer excerpts per post.
D) Is there something in your posts that makes the process take a particularly long time? Heavy shortcodes or something like that? Try using Query Monitor to see what exactly is taking so long in building the excerpts, it’s pretty good at telling you if for example a specific MySQL query is taking a long time.