With a solr-index view where the Data export display is configured to use batched export, I consistently get the following error when trying to export the file:
Fatal error: Call to a member function addMetaData() on a non-object in .../sites/all/modules/contrib/views_data_export/plugins/views_data_export_plugin_display_export.inc on line 734
I started to look a bit closer; $view->build_info
is in it's initial state, as though $view->build()
had not executed. However calling $view->build()
does not turn $view->build_info['query']
or $view->build_info['count_query']
into SelectQuery
objects. They are still empty strings.
I did not look further.
Comment | File | Size | Author |
---|---|---|---|
#14 | views_data_export-solr_export-1258390-13.patch | 5.77 KB | Sneakyvv |
#12 | views_data_export-solr_export-1258390-12.patch | 5.62 KB | Sneakyvv |
#10 | views_data_export_search_api_hack.patch | 4.65 KB | GaëlG |
Comments
Comment #1
Steven Jones CreditAttribution: Steven Jones commentedYeah...this module isn't going to work with a Solr backend, as it needs the SQL to do the export magic. We should have made this more clear, and not let you use it on a non-SQL base table, but when we originally wrote the module this part of views wasn't stable and we couldn't reliably detect base tables we could be applied to safely.
We should.
Comment #2
Bevan CreditAttribution: Bevan commentedMost of the module works with the solr backend. Only some features are broken. Perhaps just those features can be disabled with non-SQL views backends?
Comment #3
rooby CreditAttribution: rooby commentedSo is it only with batched that it breaks?
Comment #4
Bevan CreditAttribution: Bevan commentedrooby: There may be other features which are broken with non-SQL views backends such as Solr-indexes. I did not find any, but I did not look hard either.
Comment #5
rooby CreditAttribution: rooby commentedYeah, for my usage it is working OK without batching.
Comment #6
GaëlGAs Crell said in #1532472: Hard-coded dependency on SQL Views query plugin, batched export should be made available for any query back-end. I could try to work on it. Has someone any idea on where and how to start?
Comment #7
GaëlGCurrently, it only works when the query plugin is views_plugin_query_default. Search API declares its own query plugin: SearchApiViewsQuery.
I don't really know what would be the best way to do what I want. As far as I understand, the query is done at the beginning of the batch process, and the result is stored in a database table. Then, each batch iteration renders an amount of results.
This logic could be kept, but the implementation might be pretty different. If I'm right, results storing is done with this statement:
This works because initial query is SQL. But of course this won't work for a Solr query.
And if we manage to get the results in the database in the same format, will that be OK with no changes to the rest of the code? Will rendering work? I don't know well how Views code works, which confuse me a bit actually. I don't want to lose much time in wrong ways. So, any help from a maintainer would be greatly appreciated.
Comment #8
Steven Jones CreditAttribution: Steven Jones commentedReally sorry, the code is amazingly messy, and we've been always meaning to refactor the whole thing. We're attempting to carve out some time so that we can give this a couple of weeks of proper development.
Comment #9
GaëlGOK, thank you for the answer. I suppose this means we just have to wait. Any idea about when it would be available (at least in dev)? For me to know if I have to find another way right now (custom code, switch to SQL backend, tell the customer it won't work for big exports,...) or if it will be done before project deadline.
Comment #10
GaëlGI could not wait more. Here's the hack I did to have it work with Search API Views. Not easy.
Comment #11
ptitwolfy CreditAttribution: ptitwolfy commentedThanks GaelG for your patch, seems to be working well on latest dev.
Comment #12
Sneakyvv CreditAttribution: Sneakyvv commentedThe post from #1258390-10: Add support for batched exports of Search API views didn't work for me, particularly this part
as the latest dev version doesn't have an if which should before line 586, nor could I find the else.
Therefore I attached an updated patch.
Comment #14
Sneakyvv CreditAttribution: Sneakyvv commentedignore patch from #12... I was switching my git repo between dev and beta and accidentally posted the beta-patch here.
Correct patch attached
Comment #15
rerooting CreditAttribution: rerooting commentedJust used this, appears to work just fine with search api with both batch export mode and the normal export.
Strangely, I did not need to use the patch you provided in https://drupal.org/node/2080297#comment-7822017 for my batch export... using views_data_export development (not git)
Comment #16
guillaumev CreditAttribution: guillaumev commentedI can confirm this patch works
Comment #17
milesw CreditAttribution: milesw commentedGreat patch. I can confirm this allows batching to work with Search API Views with a database backend.
Comment #18
MichaelGow CreditAttribution: MichaelGow commentedThe patch certainly did fix the "Call to a member function addMetaData() on a non-object" for View based on Multi-index searches 7.x-1.1 for Search API 7.x-1.11 using Solr search 7.x-1.4 , but there still remains error:
Comment #19
caco13 CreditAttribution: caco13 commented#14 worked for me too.
Great patch!
Comment #20
opi CreditAttribution: opi commentedConfirm that #14 ' patch allows me to do batched export using SearchAPI and a database backend (not a Solr one). Thanks for this patch !
Comment #21
vikramy CreditAttribution: vikramy as a volunteer commented#14 works for me too. Thank you.
Comment #22
opi CreditAttribution: opi commented#14 works for me again on last release : 7.x-3.0-beta9
Comment #23
joelhsmith CreditAttribution: joelhsmith as a volunteer commentedI was using Faceted Search, SearchAPI (not with Solr). I can confirm #14 works in this case also.
Comment #24
ignat.volosky CreditAttribution: ignat.volosky commentedI have applied patch from #14 and it helped me. But when I try to start another export from database (not SOLR), I get next:
"PDOException : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'blabla.views_data_export_index_16' doesn't exist" on line 301 in plugins/views_data_export_plugin_display_export.inc
This export worked good before patching. I use beta9 version.
Comment #25
ignat.volosky CreditAttribution: ignat.volosky commentedI have found a problem. Patch add the condition by query plugin class name in initialize_index method - 'SearchApiViewsQuery' for search_api based queries, and 'views_plugin_query_default' for others. But my views use 'views_contextual_filters_or_query' and that was a problem, index for view wasn't initialized.
Comment #26
drummWe ran into this on Jobs.Drupal.org, which uses Search API and has reports.
The patch still applies and works for us.
Comment #27
opi CreditAttribution: opi as a volunteer commentedPatch from #14 still apply fine on latest stable release 7.x-3.1, and allows me to do batched export with a SQL backend.
Comment #28
Loparev CreditAttribution: Loparev commented+
Comment #29
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commentedThanks for the work on this.
I'm really torn between committing this, and sending this back for more work, specifically because adding switch statements just seems messy.
However, as this issue shows we're rubbish at getting around to committing things, so I'm just going to throw it into the dev branch anyway.
Comment #31
Steven Jones CreditAttribution: Steven Jones at ComputerMinds commented