</permacrud>
</class>
+ <class id="cmsa" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::metabib_search_alias" oils_persist:tablename="config.metabib_search_alias" reporter:label="Metabib Search Alias">
+ <fields oils_persist:primary="alias">
+ <field reporter:label="Alias (RegExp)" name="alias" reporter:datatype="text"/>
+ <field reporter:label="Class" name="field_class" reporter:datatype="link"/>
+ <field reporter:label="Field" name="field" reporter:datatype="link"/>
+ </fields>
+ <links>
+ <link field="field_class" reltype="has_a" key="name" map="" class="cmc"/>
+ <link field="field" reltype="has_a" key="id" map="" class="cmf"/>
+ </links>
+ <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
+ <actions>
+ <create permission="CREATE_METABIB_SEARCH_ALIAS" global_required="true"/>
+ <retrieve/>
+ <update permission="UPDATE_METABIB_SEARCH_ALIAS" global_required="true"/>
+ <delete permission="DELETE_METABIB_SEARCH_ALIAS" global_required="true"/>
+ </actions>
+ </permacrud>
+ </class>
+
<class id="cmc" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="config::metabib_class" oils_persist:tablename="config.metabib_class" reporter:label="Metabib Class">
<fields oils_persist:primary="name">
<field reporter:label="Name" name="name" reporter:datatype="text"/>
return $self->search_field_id_map;
}
+sub initialize_aliases {
+ my $self = shift;
+ my $cmsa_list = shift;
+
+ for my $cmsa (@$cmsa_list) {
+ if (!$cmsa->field) {
+ __PACKAGE__->add_search_class_alias( $cmsa->field_class, $cmsa->alias );
+ } else {
+ my $c = $self->search_field_class_by_id( $cmsa->field );
+ __PACKAGE__->add_search_field_alias( $cmsa->field_class, $c->{field}, $cmsa->alias );
+ }
+ }
+
+ return $self->relevance_bumps;
+}
+
sub initialize_relevance_bumps {
my $self = shift;
my $sra_list = shift;
$self->initialize_search_field_id_map( $args{config_metabib_field} )
if ($args{config_metabib_field});
+ $self->initialize_aliases( $args{config_metabib_search_alias} )
+ if ($args{config_metabib_search_alias});
+
$self->initialize_relevance_bumps( $args{search_relevance_adjustment} )
if ($args{search_relevance_adjustment});
$_complete = 1 if (
$args{config_metabib_field_index_norm_map} &&
$args{search_relevance_adjustment} &&
+ $args{config_metabib_search_alias} &&
$args{config_metabib_field}
);
'open-ils.cstore.direct.config.metabib_field.search.atomic',
{ id => { "!=" => undef } }
)->gather(1),
+ config_metabib_search_alias =>
+ $cstore->request(
+ 'open-ils.cstore.direct.config.metabib_search_alias.search.atomic',
+ { id => { "!=" => undef } }
+ )->gather(1),
);
$cstore->disconnect;
install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
);
-INSERT INTO config.upgrade_log (version) VALUES ('0214'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0215'); -- Scott McKellar
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
CREATE UNIQUE INDEX config_metabib_field_class_name_idx ON config.metabib_field (field_class, name);
+CREATE TABLE config.metabib_search_alias (
+ alias TEXT PRIMARY KEY,
+ field_class TEXT NOT NULL REFERENCES config.metabib_class (name),
+ field INT REFERENCES config.metabib_field (id)
+);
+
CREATE TABLE config.non_cataloged_type (
id SERIAL PRIMARY KEY,
owning_lib INT NOT NULL, -- REFERENCES actor.org_unit (id),
(16, 'subject', 'complete', oils_i18n_gettext(16, 'All Subjects', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
SELECT SETVAL('config.metabib_field_id_seq'::TEXT, (SELECT MAX(id) FROM config.metabib_field), TRUE);
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('kw','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.keyword','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.publisher','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.identifier','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.subjecttitle','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.genre','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.edition','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('srw.serverchoice','keyword');
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('au','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('creator','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.author','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.creator','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.contributor','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonal','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonalfamily','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonalgiven','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namecorporate','author',7);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.nameconference','author',9);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('ti','title');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.title','title');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.title','title');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleabbreviated','title',2);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleuniform','title',5);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titletranslated','title',3);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titlealternative','title',4);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.title','title',2);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('su','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.subject','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.subject','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectplace','subject',11);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectname','subject',12);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectoccupation','subject',16);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('se','series');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.series','series');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleseries','series',1);
+
+
INSERT INTO config.non_cataloged_type ( id, owning_lib, name ) VALUES ( 1, 1, oils_i18n_gettext(1, 'Paperback Book', 'cnct', 'name') );
SELECT SETVAL('config.non_cataloged_type_id_seq'::TEXT, 100);
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0215'); -- miker
+
+
+CREATE TABLE config.metabib_search_alias (
+ alias TEXT PRIMARY KEY,
+ field_class TEXT NOT NULL REFERENCES config.metabib_class (name),
+ field INT REFERENCES config.metabib_field (id)
+);
+
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('kw','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.keyword','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.publisher','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.identifier','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.subjecttitle','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.genre','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.edition','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('srw.serverchoice','keyword');
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('au','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('creator','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.author','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.creator','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.contributor','author');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.name','author');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonal','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonalfamily','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namepersonalgiven','author',8);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.namecorporate','author',7);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.nameconference','author',9);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('ti','title');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.title','title');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.title','title');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleabbreviated','title',2);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleuniform','title',5);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titletranslated','title',3);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titlealternative','title',4);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.title','title',2);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('su','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.subject','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.subject','subject');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectplace','subject',11);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectname','subject',12);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.subjectoccupation','subject',16);
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('se','series');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.series','series');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('bib.titleseries','series',1);
+
+COMMIT;
+