forward_limit INT;
forward_to_pivot INT;
mbedm_mattype_filter TEXT DEFAULT '';
- mbeshm_mattype_filter TEXT DEFAULT '';
BEGIN
--ver1.1 updated with kmain-806
-- Get search field int list with search_class
IF item_type IS NOT NULL THEN
mbedm_mattype_filter := $x$
AND mbedm.source IN (
- SELECT id FROM metabib.record_attr
- WHERE attrs-> 'mattype' = '$x$ || item_type || $x$'
+ -- NOTE joining directly to metabib.record_attr_vector_list
+ -- is considerably faster than using the record_attr view
+ -- for expansive queries like this.
+ SELECT vec.source
+ FROM metabib.record_attr_vector_list vec
+ JOIN config.coded_value_map ccvm
+ ON (ccvm.ctype = 'mattype' AND ccvm.id = ANY (vec.vlist))
+ WHERE ccvm.code = '$x$ || item_type || $x$'
)
$x$;
-
- mbeshm_mattype_filter := $x$
- AND mbeshm.entry IN (
- SELECT id FROM metabib.record_attr
- WHERE attrs-> 'mattype' = '$x$ || item_type || $x$'
- )
- $x$;
-
END IF;
create temporary table tmp_metabib_browse
ash.atag = map.authority_field
AND map.metabib_field = ANY(' || quote_literal(search_field) || ')
)
- WHERE mbeshm.entry = mbe.id ' || mbeshm_mattype_filter || '
+ WHERE mbeshm.entry = mbe.id
)';
END IF;