I was about to make an user defined function to implement faceted search in a hypergraph based database where the function will return facets with counts. problem is I need to pass the set of fields to be searched in. I am not sure how to do it. Please have a look at the function and help me. I want to pass search_fields somewhat like {'node_type', 'node_title', 'title'} etc.
CREATE OR REPLACE FUNCTION facets(
IN keyword text, IN search_fields text, IN relation_name text, IN node_type text, IN group_by text,
OUT facet text, OUT count integer
)
RETURNS SETOF record AS
$BODY$
Thanks
selectbe to return thecountfor two columns keyword and search_fields? One count for each column? What is in the set your example function returns?