Problem/Motivation
Hi, we have been running this wonderful module for years using custom Actions and even supporting Faceting for Views that are driven by the Drupal Search API (in specific Solr). Last working version for us was 4.4.5. 4.4.6 breaks any support
by Removing:
if (!\method_exists($this->view->query, 'addWhere')) {
throw new \Exception(\sprintf('Unsupported query type: %s', $this->view->query::class));
}
$this->view->query->addWhere('views_bulk_operations', $base_field_alias, $base_field_values, 'IN');
// Rebuild the view query.
$this->view->query->build($this->view);
and adding
@@ -358,6 +354,16 @@ class ViewsBulkOperationsActionProcessor implements ViewsBulkOperationsActionPro
// query. Give those modules the opportunity to alter the query again.
$this->view->query->alter($this->view);
if (!($this->view->build_info['query'] instanceof SelectInterface)) {
throw new \Exception(\sprintf('Unsupported query type: %s', $this->view->query::class));
}
// Add the IN condition directly to the built DB query rather than via
// addWhere(). Using addWhere() is unreliable here because the type of
// conjunction (OR or AND) relies on many factors regardless of the filter
// group used. The SelectQuery root condition is always AND.
$this->view->build_info['query']->condition($base_field_alias, $base_field_values, 'IN');
I understand the optimization, but reall, this breaks 32 sites we have! I wonder if you would accept a pull that checks if
$this->view->build_info['query'] exists ... IF not, goes back to the previous check using a `addWhere`, if there (SQL views) runs the 'IN' Condition?
This is the specific commit https://git.drupalcode.org/project/views_bulk_operations/-/commit/513b37...
Steps to reproduce
Upgrade to 4.4.6
Use VBO in a Search API driven View
Proposed resolution
Make the optimization an optional without breaking the fact this Module uses most logic on the underlaying Views logic and not the Plugin that drives the data
Remaining tasks
Get feedback
User interface changes
API changes
Data model changes
Thanks a lot!
Issue fork views_bulk_operations-3610975
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
diegopino commentedThis is the exception thrown in 4.4.6
Comment #3
graber commentedThanks for reporting this.
I'll fix it and add a regression test.
Maybe a good time to present my current situation..
The VBO module 8.x+ currently has almost 90000 installs worldwide, that is 20% of the entire Drupal 8.x+ installs
A few facts:
- Drupal core developers have their work sponsored in most cases, I'm working for free since the beginning of the project.
- I'm almost alone here and there are about 10 core developers.
- Core developers are invited to DrupalCON events and I have very little chances of getting a talk accepted which means I don't have a chance to meet friends from the community as I can't afford the ticket and additional costs.
While I'm perfectly fine with the first 2 issues as I believe I'm doing a good job and fixes / improvements are not very time consuming due to good architecture, I find the last issue very touching.
If anyone could help me in getting to Europe DrupalCons.. I'd really appreciate it and it'd make my work sufficiently rewarding not to feel bad every time someone asks me for more. If anyone has an idea how module users could help me get there, please get in touch, contact form or Drupal Slack.
Now to the issue.
Comment #5
graber commentedCan someone please test if this covers all on a real search_api data before we release?
Comment #6
diegopino commented@graber. Thanks for the quick reacting and fix. I will test during the day with real data and do some debugging too. The tests you wrote also really help.
I hear and feel you about the complexities of being an OSS maintainer plus the extra Drupal reality of Core v/s non Core contributors, specially for you developing a module that is so popular and widely used as this one. I could not afford to sponsor a complete trip (I am also an OSS maintainer, just different reality) but i do contribute a bit to other projects, e.g webform one. They use https://oscollective.org. Maybe that is a way for you? Many small contributions instead of a single large sponsor? Just an idea.
Will report back after testing. Thanks so much
Comment #7
diegopino commentedHi @graber, confirming your regression fix works perfectly and code is sound too.
Did multiple manual tests with Search API Views (driven by Solr), using filters + our custom VBO processors + built int ones + our custom facet integration too. All works/no warnings, query is modified correctly. Thanks so much @graber!
Comment #9
graber commentedThanks for the review, releasing.