drop type __pgswish cascade;

CREATE TYPE __pgswish AS (
	rank integer,
	path text,
	headline text,
	size integer
);

-- Search swish-e index as table
-- select * from pgswish('/index/path/','query', 'sort');
CREATE OR REPLACE FUNCTION pgswish(text, text, text)
	RETURNS SETOF __pgswish
	AS 'pgswish', 'pgswish'
	LANGUAGE C IMMUTABLE STRICT;

-- select * from pgswish_arr('/index/path', 'query', 'placeholder', limit, offset, ARRAY['@id','@title','@size']) as (id text, title text, size text);
CREATE OR REPLACE FUNCTION pgswish(text, text, text, int, int, text[])
	RETURNS setof record
	AS 'pgswish','pgswish_arr'
	LANGUAGE 'C' IMMUTABLE CALLED ON NULL INPUT;
