When creating a View based on Apache SOLR Views (http://drupal.org/project/apachesolr_views), getting the list of operations for the Views admin UI, the list of operations isn't built.
In _views_bulk_operations_object_info_for_view(), the check that $object_info['base_table'] == $view->base_table
fails, resulting in no operations returned due to $view->base_table not existing.
Expanding the check's logic to $object_info['base_table'] == $view->base_table || ($view->base_table == 'apachesolr')
will allow views created using the Apache SOLR Views Integration to get the list of operations.
My initial testing, indicates that once this is in place, Views 3, VBO and Apache SOLR Views play nice together.
Comment | File | Size | Author |
---|---|---|---|
#9 | apachesolr_views-773728-8.patch | 1.09 KB | mlsamuelson |
#8 | apachesolr_views-773728-8.patch | 1.09 KB | mlsamuelson |
#1 | views_bulk_operations-773728.patch | 932 bytes | mlsamuelson |
Comments
Comment #1
mlsamuelson CreditAttribution: mlsamuelson commentedPatch attached.
Comment #2
Scott Reynolds CreditAttribution: Scott Reynolds commentedAs the solr views maintainer this strikes me as naive. Will test it though.
Comment #3
infojunkieWaiting for test results. If anyone could explain why Apache SOLR Views changes the
$view->base_table
attribute, it would help clarify the logic needed.Comment #4
mlsamuelson CreditAttribution: mlsamuelson commented@Scott Reynolds Definitely is naive. :) Once I found the hangup in VBO, I tried this (the patch) and from the testing I've done so far - at least on standard node results, it's worked without error for me. Doesn't mean we shouldn't look further upstream into Apache SOLR Views... but at least this starts the conversation.
Comment #5
Scott Reynolds CreditAttribution: Scott Reynolds commentedSo the base_table for a View defines what fields, arguments, filters, relationships, header, footer, and empty text handlers can be used. Since Apache Solr is a separate separate Database, the base table can't be 'node' even though we would like to use the 'node' actions etc on the result set. Still haven't come up with an alternative approach.
Comment #6
infojunkie@Scott Reynolds, thanks for the explanation. I looked at the module's code a few days ago and that's what I thought.
Of course, I won't be able to commit the patch sent here. What I suggest instead is to let the module implement the hook
hook_views_bulk_operations_object_info
that allows extending VBO with new view types. In this case, here are the parameters I expect to work:This hook tells VBO that when it encounters a view of type 'apachesolr', what it's dealing with is really node entities.
Comment #7
mlsamuelson CreditAttribution: mlsamuelson commentedThat should probably be "apachesolr" as the top level key in the array, right? Otherwise, you end up doubling the entries in the node array.
Comment #8
mlsamuelson CreditAttribution: mlsamuelson commentedChanging project to Apache SOLR Views.
New patch attached that incorporates the hook from #7 into apachesolr_views.module.
VBO and Apache SOLR Views are working together.
Comment #9
mlsamuelson CreditAttribution: mlsamuelson commentedSomething went wrong in the save of comment #8. The path for the patch isn't working correctly. Posting it again.
Comment #10
digi24 CreditAttribution: digi24 commentedThe latest commit in cvs http://drupal.org/cvs?commit=369072 breaks this patch. The base table part needs to be adjusted. As I am only using apachesolr_views in node context, my quick fix was to hardcode the apachesolr_node base table, but obvoiusly this is not a clean solution.
Comment #11
dpalmer CreditAttribution: dpalmer commentedSubscribing.
Comment #12
lewie6 CreditAttribution: lewie6 commentedany ideas on this?
Comment #13
tbenice CreditAttribution: tbenice commentedTried adding #7 to apachesolr_views as:
but there still is no list of actions in the views ui. going to try the workaround in #1 for now. Boy this would be nice!
EDIT: changed base_table to 'apachesolr_node' and it worked. For some reason I thought it was the actual db table name needed but it's the one used by views.
Comment #14
itarato CreditAttribution: itarato commentedHi there,
I've created a connector that does the basic integration. Feedback and patches are more than welcomed: http://drupal.org/project/apachesolr_vbo