Would it be possible to share the parameter values to this function?
Also, would it be possible to use the pySearchResultsWork List View instead?
Sharing parameter to this function does not needed at first sight at it. Because doSearch function(activity) only sends soap request to ConnectRuleSearch (standard connect soap ), request is handled and than results are passed.
pySearchResultsWork List View can not be used instead because there are used specific data for searching and there are showed specific data.
There are some generic options that Lucene recommends for query execution. The first one is not to use a prefix wildcard. The second is to filter results based on targeted fields. But all of these are also a function of the size of the index what the search string is (how generic it is).
How slow is the query right now? There have been improvements in newer versions of Pega platform through the upgrade of Lucene library in 6.3 and to Elastic Search in 7.1.7. They have definitely improved the performance of full text search in the Pega platform.
Also, you might want to install HFIX-5451 to reduce the memory footprint of Lucene in 6.1 SP2.