Provide a full suite of search/browse top/center alpha/rank functions based on author...
authorMike Rylander <mrylander@gmail.com>
Fri, 23 Sep 2011 19:57:58 +0000 (15:57 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 4 Oct 2011 03:24:30 +0000 (23:24 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/011.schema.authority.sql

index 838de08..15c1a9b 100644 (file)
@@ -328,54 +328,6 @@ index to defend against duplicated authority records from the same
 thesaurus.
 $$;
 
-CREATE OR REPLACE FUNCTION authority.find_start_pivot( a TEXT, q TEXT, lim INT DEFAULT 10, offs INT DEFAULT 0 ) RETURNS TABLE (rank NUMERIC, id BIGINT, record BIGINT, atag INT, value TEXT, sort_value TEXT) AS $$
-BEGIN
-    RETURN QUERY
-        SELECT  ts_rank_cd(ash.index_vector,ptsq.term,14)::numeric
-                    + CASE WHEN ash.sort_value LIKE t.term || '%' THEN 2 ELSE 0 END
-                    + CASE WHEN ash.value LIKE t.term || '%' THEN 1 ELSE 0 END,
-                ash.id,
-                ash.record,
-                ash.atag,
-                ash.value,
-                ash.sort_value
-          FROM  authority.simple_heading ash
-                JOIN authority.control_set_authority_field acsaf ON (acsaf.id = ash.atag)
-                JOIN authority.browse_axis_authority_field_map abaafm ON (abaafm.field = acsaf.id),
-                public.naco_normalize(q) t(term),
-                plainto_tsquery(q) ptsq(term)
-          WHERE abaafm.axis = a
-                AND ash.sort_value >= t.term OR ash.value >= t.term
-          ORDER BY ash.sort_value, 1 DESC
-          LIMIT lim
-          OFFSET offs;
-END;
-$$ LANGUAGE PLPGSQL ROWS 10;
-
-CREATE OR REPLACE FUNCTION authority.find_search_pivot( a TEXT, q TEXT, lim INT DEFAULT 10, offs INT DEFAULT 0 ) RETURNS TABLE (rank NUMERIC, id BIGINT, record BIGINT, atag INT, value TEXT, sort_value TEXT) AS $$
-BEGIN
-    RETURN QUERY
-        SELECT  ts_rank_cd(ash.index_vector,ptsq.term,14)::numeric
-                    + CASE WHEN ash.sort_value LIKE t.term || '%' THEN 2 ELSE 0 END
-                    + CASE WHEN ash.value LIKE t.term || '%' THEN 1 ELSE 0 END,
-                ash.id,
-                ash.record,
-                ash.atag,
-                ash.value,
-                ash.sort_value
-          FROM  authority.simple_heading ash
-                JOIN authority.control_set_authority_field acsaf ON (acsaf.id = ash.atag)
-                JOIN authority.browse_axis_authority_field_map abaafm ON (abaafm.field = acsaf.id),
-                public.naco_normalize(q) t(term),
-                plainto_tsquery(q) ptsq(term)
-          WHERE abaafm.axis = a
-                AND ash.index_vector @@ ptsq.term
-          ORDER BY 1 DESC, ash.sort_value
-          LIMIT lim
-          OFFSET offs;
-END;
-$$ LANGUAGE PLPGSQL ROWS 10;
-
 -- Adding indexes using oils_xpath_string() for the main entry tags described in
 -- authority.control_set_authority_field would speed this up, if we ever want to use it, though
 -- the existing index on authority.normalize_heading() helps already with a record in hand