Is there a way to get all the possible/existing values out of a given facet? I've looked through various parts of the code but not managed to find anything and quickly got out of my depth with realms/searchers/etc.

The reason I'm after this is that I want to make a field type that points to a facet & value combination, to make landing pages that embed search results, or link to them.

Comments

cpliakas’s picture

Hi joachim.

So the tricky part here is that it is really outside of Facet API's scope right now because the backend is responsible for executing some search, gathering the facet data, and sending it to Facet API. If you are using Solr, there is nothing stopping you from executing an empty search at which point you should have the facet data. Check out the apachesolr_search_init() function, focusing on line 58. The apachesolr_search_run_empty() function should initialize the facets for you. If you are using another backend then you will have to ask those maintainers for help, as I am not as familiar with their APIs.

Hope this helps,
Chris

marcusx’s picture

Issue summary: View changes

Hi @joachim

The reason I'm after this is that I want to make a field type that points to a facet & value combination, to make landing pages that embed search results, or link to them.

What was your solution 3 years ago? I have the same problem now. I have a node type I called persistent_search with several metadata and some search results on it. At the moment I store key|values for facetname|item1,item2 in a simple text field. But this will not work with the editors that will create those nodes later. So is there a userfriendly solution for storing facets and some of the possible items already somewhere?

Thanks and Regards
mx

joachim’s picture

Sorry, I don't remember at all what we did with this, and I'm no longer on that project so I can't look at the codebase.