Performance statistics doesn't show up in Views UI because query information is empty.

Steps to reproduce:

  1. Go to admin/structure/views/settings page, enable "Show the SQL query" and "Show performance statistics".
  2. Create new Search API view, click "Update preview". SQL query and performance statistics are empty.

Comments

Plazik created an issue. See original summary.

plazik’s picture

Status: Active » Needs review
StatusFileSize
new629 bytes
drunken monkey’s picture

Category: Bug report » Feature request
Issue tags: +needs port to Drupal 8
StatusFileSize
new1.68 KB

Awesome idea, thanks a lot for suggesting this!
I made a few alterations to your patch, please see the attached version. (Specifically, I'm applying a fix from D8 to the __toString() method that prevents mayhem when the query options contain objects.) Please test/review and see if this still works for you!

Also, while not really part of this issue, we might (like in D8) also add a reference to the view to the query in the search_api_view option. But, as said, not really part of this issue, so we can also commit this just as-is. (That's what caused the problems that needed the mentioned fix in D8, btw.)

Finally, this will give us the query at the time it was built in Views – is this what we want here? Afterwards, there's still processors and hooks that could modify the query, do we want to show that version instead? (Then we'd have to put that line after the query is executed in execute().)
Probably it's fine like this, though. Still, would be interested in your thoughts on that.

plazik’s picture

Status: Needs review » Reviewed & tested by the community

I've tested your path, it works fine for me.

Finally, this will give us the query at the time it was built in Views – is this what we want here?

Yes, like in Views core http://cgit.drupalcode.org/views/tree/plugins/views_plugin_query_default...

  • drunken monkey committed ef5fc55 on 7.x-1.x authored by Plazik
    Issue #2769021 by Plazik, drunken monkey: Added the generated Search API...
drunken monkey’s picture

Version: 7.x-1.x-dev » 8.x-1.x-dev
Status: Reviewed & tested by the community » Patch (to be ported)
Issue tags: -needs port to Drupal 8 +Novice

OK, great. Committed.
Thanks again!

Moving to D8 for porting.

drunken monkey’s picture

Issue tags: +release target

  • drunken monkey committed 7b2e464 on 8.x-1.x
    Issue #2769021 by drunken monkey: Added the generated Search API query...
drunken monkey’s picture

Status: Patch (to be ported) » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

idebr’s picture

It may be worth noting that not every query can be cast to a string. I recently updated Search API to 7.x-1.21, but without this commit in search_api_multi searching results in a recoverable fatal error: Recoverable fatal error: Object of class SearchApiMultiQuery could not be converted to string in build()