I am trying to show the query execution time in a View where I'm using the Search API module to return results from an index in Apache Solr. I am pretty sure that in the past I could print something like:

Your query returned 234 results in 0.035 milliseconds

at the top or the bottom of the view, but this may have been a feature of the Search API Pages module (which I can't use since it does not work properly for me).

I have searched the various "things" that you can add in the header and the footer part of the view but there is no replacement pattern for this kind of information.

Am I missing an option somewhere? If this is not possible through the UI, is there maybe a way to retrieve and print this programmatically in the Views' template system?

Thanks in advance.

  • Have you even tried to search the code for parts of that string? – leymannx Aug 12 '18 at 11:44
  • Did you check devel module, it shows each query execution time on page load (for user with permissions). – Yogesh Aug 12 '18 at 14:14
  • @Yogesh the OP was asking about the Solr execution time (it's not an SQL query). Also they don't say but they might want it shown to end users - definitely not a job for Devel. – Alfred Armstrong Aug 13 '18 at 8:51
  • @Lim it looks like you might need to write some custom code to solve this. What version of Drupal is this, and are you confident with PHP? – Alfred Armstrong Aug 13 '18 at 10:14
  • @AlfredArmstrong This is D7. I'm very confident with PHP. I just can't find a way to get that information (what do I alter? is there an API call that I could do to Search API?) so that I can then alter the view and add this information in it – user4979 Aug 19 '18 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy