- Issue created by @hartsak
- 🇫🇮Finland hartsak
In case this helps a bit more, here are all the items from the same slow stack. I realized I had previously only added one of these as an example but I don't know how to get this information out of New Relic in a better way.
Could it be that I have too many (fulltext) fields where the highlight processor should run?
- Drupal\search_api\Query\Query::postExecute
- Drupal\search_api\Entity\Index::postprocessSearchResults
- Drupal\search_api\Plugin\search_api\processor\Highlight::postprocessSearchResults
- Drupal\search_api\Plugin\search_api\processor\Highlight::addExcerpts
- Drupal\search_api\Plugin\search_api\processor\Highlight::getFulltextFields
- Drupal\search_api\Utility\FieldsHelper::extractItemValues
- Status changed to Postponed: needs info
11 months ago 8:46pm 25 December 2023 - 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for reporting this issue?
If the time is mostly spent inFieldsHelper::extractItemValues()
it seems like this cannot be a similar problem as the HTML Filter processor, which was about (semi-)parsing HTML. Which the Highlight processor does, too, so it really would have been an option, especially since there was a change in this code not too long ago ( 🐛 A PCRE error (#2) occurred during results highlighting. Fixed ) – if you upgraded from a version before 1.29, then that would have been newly in there.However, as it stands, this seems to have more to do with field extraction. Are you maybe using fields for the excerpt which might be very slow to retrieve, e.g., attachments? You should exclude those fields from the excerpt via the “Exclude fields from excerpt” option. (Or, of course, disable the whole processor if you’re not using it anyways.)
Why this only showed after an update is another mystery in that case, though. Maybe you’re using Solr, upgraded that module, too, and then Solr suddenly failed to retrieve those fields (in a usable form)? For debugging, you could try downgrading just the Search API module and seeing if that fixes the issue. (If you are still interested in investigating this, of course – otherwise, we’ll have to wait and see whether someone else complains about this.)In any case, thanks again for reporting, and for the detailed information.
- Status changed to Fixed
10 months ago 8:21am 8 January 2024 - 🇫🇮Finland hartsak
Thank you very much for the reply @drunken monkey!
It's just as you said - one of the fields enabled in the highlight processor was indeed a "Search api attachments" field. I hadn't paid any attention to those settings as I wasn't the original creator of that particular search index. That might very well be the reason why the highlight filter caused some performance issues in my case. I did a double check of that (it's always good to conduct testing in a production environment...) by enabling the highlight filter again and looking at the transaction data in New Relic.
After I selected these in the "Exclude fields from excerpt" options the performance issues were gone:
* rendered html output (might have very well contained some attachments in some cases)
* search api attachments fields (important!)
* taxonomy reference fields (not completely sure was this needed too, but it might have helped)And just for the record I have the following module versions enabled:
* search_api: 8.x-1.31
* search_api_solr: 4.3.1
* search_api_attachments: 9.0.2
* Drupal: 10.1.6
* SOLR: 8.5.2So I guess this ticket is no longer needed, as the problem is solved in my case. Thanks a lot for help!
Automatically closed - issue fixed for 2 weeks with no activity.