data_export displays should respect facet values set on the View display to which they're attached.
I'm still trying to wrap my head around facet source plugins in Facets and how they're derived from search api display plugins (mostly looking at #2648260: Add a "display" plugin type to list all known search pages) -- is the intention for other contrib modules to add their own search api display plugins?
Anyway, doing so for the data_export display type a la the simple forthcoming patch works for me with search_api 1.0-beta2 and facets 1.0-alpha6.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | facets-support-2827696-5.patch | 664 bytes | arh1 |
| #2 | facets-support-2827696-2.patch | 693 bytes | arh1 |
Comments
Comment #2
arh1 commentedComment #3
arh1 commentedComment #5
arh1 commentedOops, this patch should properly create the new file.
Comment #6
jhedstromThis may be related to #2767389: Facet filters not retained after search.
Comment #7
jhedstromAh, I see what this is doing. @arh1 how are you using this? Do you need to create a separate and parallel facet for every facet associated with a page display, to one associated with the views data export display?
Comment #8
arh1 commented@jhedstrom yeah, that's right. With the patch I can use a data_export display as a facet source, and create the same facets with that source as I have with the page display source. Providing the facet source via a search api plugin is my understanding of what facets wants per #2648260: Add a "display" plugin type to list all known search pages but I may be wrong!
Comment #9
borisson_Yes, it should be enough to provide a search api display plugin. We're currently integrating with those plugins over at #2772745: Search API integration doesn't check/define feature support of backends.
Comment #10
jhedstromI've added #2836477: Consider adding a 'default' views display plugin, as I was sort of able to get this to work, but the views 'attach to' feature, which adds an icon to the bottom of a view inherited the page display url key, so the downloaded file is not filtered as expected...
Comment #12
jhedstromThanks @arh1. After the feedback you left in #2836477-03: Consider adding a 'default' views display plugin, this does indeed work. The key is to ensure the 2 facet sources are using the same query key, and then to ensure they are also using the same url alias. This alias defaults to the facet machine name, so must be manually set to match.
I've committed this patch. Thanks again!
Comment #13
arh1 commentedAwesome -- thanks, @jhedstrom! And thanks for clarifying the steps needed. Should've written those out more clearly :)
Comment #15
hazaI don't want to re-open, but I tested this and I can't manage to get it working.
Search_api beta4 and facets alpha7, I added the same facets for the views data export attachment, with the same url alias using the default query key (I tested, they are the same) but the data export still exports unfaceted results.
Any idea about this ?
Comment #16
borisson_That's a known issue @Haza (also mentioned on the facets project page (https://www.drupal.org/project/facets)). beta3 + alpha 7 are the last known working compatible version. After sufficient manual tests of https://www.drupal.org/node/2772745#comment-11879283 we'll commit that issue and restore compatibility with beta 4.
So this will work w/ beta3 + alpha7 or beta4 + facets-dev+2772745.
Comment #17
hazaThanks for the feedback, I'll test this and let you know !
Comment #18
hazaTo let you know.
I've updated to beta4 + facets-dev+2772745 and it doesn't seems to work.
My facets are working on the page itself, but they are not working in the export views (I have all the unfaceted result set).
I'm investigating.
Comment #19
hazaOk, I think I got it.
It seems there is an issue with the name of the facet source and the name that facets is expecting in
facets_search_api_query_alter()I've created #2846357: Facets support, annotation uses a wrong ID name to handle this.
Comment #20
ressaThank you very much @jhedstrom and @arh1 for your invaluable help getting me on track with adding facets to CSV-export. I couldn't figure out how to add the Page facets to my Data Export Views Display, but your comments got me on the right track. It seems like double work to add the facets twice, but it works fine. And thank you @Haza for fixing the wrong ID name.
Comment #21
capysara commentedIs there a similar solution that would work with D7? Should I make a new feature request ticket?Please disregard. The export works in D7, but not with pretty paths.