Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There's a lot of good code in there which can be used to get a list of field facets for any type of entity, but it's buried in a node-specific function.
An example issue where this would be helpful is #1273658: Add the ability to filter by profile fields (in the Apachesolr User module).
Comment | File | Size | Author |
---|---|---|---|
#5 | 1679392-apachesolr-entity-field-facets-brianV.patch | 1.23 KB | brianV |
#5 | 1679392-apachesolr-entity-field-facets-no-searcher_info-brianV.patch | 1.48 KB | brianV |
#1 | apachesolr-entity-field-facets-1679392-1.patch | 883 bytes | David_Rothstein |
Comments
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedHere's a simple patch.
Comment #2
andymantell CreditAttribution: andymantell commentedI've tested this patch via the code in #1273658: Add the ability to filter by profile fields and can confirm it is working for me. I'm reluctant to RTBC this myself as I am unsure what else it may effect, but it is working for me within this use case at any rate.
Comment #3
Nick_vhin this case I would almost remove the apachesolr_default_node_facet_info and replace its references with the new function?
Otherwise you have a function that just has 2 lines
Comment #4
Nick_vhComment #5
brianV CreditAttribution: brianV commentedRe-rolled with improved doxygen.
I've also added a version which removes the unused $searched_info parameter from apachesolr_default_node_facet_info().
Comment #6
Nick_vhI prefer the no searcher version as the var does not make sense there.
Comment #7
Nick_vhCommitted to 7.x-1.x, thanks!
Comment #8
pwolanin CreditAttribution: pwolanin commented