User Tools

Site Tools


documentation:facet_idx_def_example

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
documentation:facet_idx_def_example [2010/06/15 16:15] – created mikerdocumentation:facet_idx_def_example [2022/02/10 13:34] (current) – external edit 127.0.0.1
Line 51: Line 51:
  
 <code sql> <code sql>
-INSERT INTO metabib.identifier_field_entry (field, source, value, index_vector)+INSERT INTO metabib.facet_entry (field, source, value)
   SELECT  CURRVAL('config.metabib_field_id_seq'::regclass),  -- Returns the id of the indexing definition inserted above   SELECT  CURRVAL('config.metabib_field_id_seq'::regclass),  -- Returns the id of the indexing definition inserted above
           mfr.record,                                        -- The source MARC record from which the data will be extracted           mfr.record,                                        -- The source MARC record from which the data will be extracted
-          value,                                             -- Coalesce all 947$t data into a single space-separated string for initial index population +          UPPERCASE(BTRIM(value,'[]'))                       -- Normalize 947$t data using the same logic as the defined above for initial index population
-          ''                                                 -- For facet fields, it is important to set the index_vector column to the empty string+
     FROM  metabib.real_full_rec AS mfr        -- The internal table holding a flattened version of the bibliographic record     FROM  metabib.real_full_rec AS mfr        -- The internal table holding a flattened version of the bibliographic record
     WHERE mfr.tag = '947' AND subfield = 't'; -- Include only subfield t from 947 tags     WHERE mfr.tag = '947' AND subfield = 't'; -- Include only subfield t from 947 tags
Line 108: Line 107:
     WHERE cin.name = 'Replace';           -- The normalizers we care about for this field     WHERE cin.name = 'Replace';           -- The normalizers we care about for this field
  
-INSERT INTO metabib.identifier_field_entry (field, source, value, index_vector)+INSERT INTO metabib.facet_entry (field, source, value)
   SELECT  CURRVAL('config.metabib_field_id_seq'::regclass),  -- Returns the id of the indexing definition inserted above   SELECT  CURRVAL('config.metabib_field_id_seq'::regclass),  -- Returns the id of the indexing definition inserted above
           mfr.record,                                        -- The source MARC record from which the data will be extracted           mfr.record,                                        -- The source MARC record from which the data will be extracted
-          value,                                             -- Data from 947$t, each row separately +          UPPERCASE(BTRIM(value,'[]'))                       -- Normalize 947$t data using the same logic as the defined above for initial index population
-          ''                                                 -- For facet fields, it is important to set the index_vector column to the empty string+
     FROM  metabib.real_full_rec AS mfr        -- The internal table holding a flattened version of the bibliographic record     FROM  metabib.real_full_rec AS mfr        -- The internal table holding a flattened version of the bibliographic record
     WHERE mfr.tag = '947' AND subfield = 't'; -- Include only subfield t from 947 tags     WHERE mfr.tag = '947' AND subfield = 't'; -- Include only subfield t from 947 tags
documentation/facet_idx_def_example.1276632923.txt.gz · Last modified: 2022/02/10 13:33 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki

© 2008-2022 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a U.S. 501(c)3 non-profit organization.