INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, search_field, authority_xpath, browse_field, browse_sort_xpath ) VALUES
(32, 'series', 'browse', oils_i18n_gettext(32, 'Series Title (Browse)', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, FALSE, '//@xlink:href', TRUE, $$*[local-name() != "nonSort"]$$ );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, browse_field, facet_field, facet_xpath, joiner ) VALUES
+ (33, 'identifier', 'genre', oils_i18n_gettext(33, 'Genre', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='655' or @tag='659']$$, FALSE, TRUE, $$//*[contains('abvxyz',@code)]$$, ' -- ' ); -- /* to fool vim */;
+
UPDATE config.metabib_field SET joiner = ' -- ' WHERE field_class = 'subject' AND name NOT IN ('name', 'complete');
SELECT SETVAL('config.metabib_field_id_seq', GREATEST(1000, (SELECT MAX(id) FROM config.metabib_field)));
--- /dev/null
+BEGIN;
+
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, browse_field, facet_field, facet_xpath, joiner ) VALUES
+ (33, 'identifier', 'genre', oils_i18n_gettext(33, 'Genre', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='655' or @tag='659']$$, FALSE, TRUE, $$//*[contains('abvxyz',@code)]$$, ' -- ' ); -- /* to fool vim */;
+
+COMMIT;
+
xpath => '//*[@tag="600" or @tag="610" or @tag="611" or @tag="630" or @tag="650" or @tag="651"]'
}, {
label => l('Genre: '),
- xpath => '//*[@tag="655"]|//*[@tag="659"]'
+ facet => 'identifier|genre',
+ joiner => ' -- ',
+ xpath => '//*[@tag="655" or @tag="659"]',
+ subfields => '[abvxyz]'
}, {
label => l('Topic Heading: '),
xpath => '//*[@tag="690"]'
];
BLOCK render_subject;
- xpath = xpath || '//*[starts-with(@tag,"6")]';
+ xpath = s.xpath || '//*[starts-with(@tag,"6")]';
FOR node IN ctx.marc_xml.findnodes(xpath);
'<span property="about">';
all_terms = [];
target_field = node.getAttribute('tag');
get_linked_880s;
END;
+
NEXT UNLESS code.match('[a-z]');
+ IF s.subfields; NEXT UNLESS code.match(s.subfields); END;
+
IF code.match('[vxyz]'); " > "; END;
+
# at this point, we actually have a partial term to use.
- single_term = subfield.textContent | html;
- all_terms.push(subfield.textContent.replace('\-', ' ').replace('[#"^$\+,\.:;&|\[\]()]', ''));
- total_term = all_terms.join(" ").replace('\s+$', '');
- %]
-<a href="[% mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms)) %]" rel="nofollow" vocab="">[% single_term %]</a>
- [%- END;
+ raw_term = subfield.textContent;
+ single_term = raw_term | html;
+
+ # facets should be used as-is
+ IF !s.facet; raw_term = raw_term.replace('\-', ' ').replace('[#"^$\+,\.:;&|\[\]()]', ''); END;
+
+ all_terms.push(raw_term);
+
+ IF s.facet;
+ total_term = s.facet _ '[' _ all_terms.join(s.joiner).replace('\s+$', '') _ ']';
+ ELSE;
+ total_term = all_terms.join(" ").replace('\s+$', '');
+ END;
+
+ %]<a href="[%-
+ mkurl(ctx.opac_root _ '/results', {qtype=>'subject', query=>total_term}, stop_parms.merge(expert_search_parms, general_search_parms, browse_search_parms, facet_search_parms))
+ -%]" rel="nofollow" vocab="">[% single_term %]</a>[%-
+
+ END;
IF all_terms.size; "<br/>"; END;
FOREACH link880 IN graphics;
'<div class="graphic880"' _ link880.dir _ '>';
[% BLOCK render_all_subjects;
FOREACH subj IN subjects;
- content = PROCESS render_subject(xpath=subj.xpath);
+ content = PROCESS render_subject(s=subj);
IF content.match('\S');
%]
<table class='rdetail_subject'>