View | Details | Raw Unified | Return to bug 14899
Collapse All | Expand All

(-)a/installer/data/mysql/elasticsearch_mapping.sql (-5 / +4 lines)
Lines 22-27 CREATE TABLE `elasticsearch_mapping` ( Link Here
22
CREATE TABLE `search_field` (
22
CREATE TABLE `search_field` (
23
  `id` int(11) NOT NULL AUTO_INCREMENT,
23
  `id` int(11) NOT NULL AUTO_INCREMENT,
24
  `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
24
  `name` varchar(255) NOT NULL COMMENT 'the name of the field as it will be stored in the search engine',
25
  `label` varchar(255) NOT NULL COMMENT 'the human readable name of the field, for display',
25
  `type` ENUM('string', 'date', 'number', 'boolean', 'sum') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
26
  `type` ENUM('string', 'date', 'number', 'boolean', 'sum') NOT NULL COMMENT 'what type of data this holds, relevant when storing it in the search engine',
26
  PRIMARY KEY (`id`),
27
  PRIMARY KEY (`id`),
27
  UNIQUE KEY (`name`)
28
  UNIQUE KEY (`name`)
Lines 46-53 CREATE TABLE `search_marc_map` ( Link Here
46
    `suggestible` boolean DEFAULT FALSE COMMENT 'true if this field can be used to generate suggestions for browse',
47
    `suggestible` boolean DEFAULT FALSE COMMENT 'true if this field can be used to generate suggestions for browse',
47
    `sort` boolean DEFAULT NULL COMMENT 'true/false creates special sort handling, null doesn''t',
48
    `sort` boolean DEFAULT NULL COMMENT 'true/false creates special sort handling, null doesn''t',
48
    PRIMARY KEY(`id`),
49
    PRIMARY KEY(`id`),
49
    INDEX (`index_name`),
50
    INDEX (`index_name`)
50
    UNIQUE KEY (index_name, marc_type, marc_field)
51
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
51
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
52
52
53
-- This joins the two search tables together. We can have any combination:
53
-- This joins the two search tables together. We can have any combination:
Lines 59-65 CREATE TABLE `search_marc_to_field` ( Link Here
59
    search_marc_map_id int(11) NOT NULL,
59
    search_marc_map_id int(11) NOT NULL,
60
    search_field_id int(11) NOT NULL,
60
    search_field_id int(11) NOT NULL,
61
    PRIMARY KEY(search_marc_map_id, search_field_id),
61
    PRIMARY KEY(search_marc_map_id, search_field_id),
62
    FOREIGN KEY(search_marc_map_id) REFERENCES search_marc_map(id),
62
    FOREIGN KEY(search_marc_map_id) REFERENCES search_marc_map(id) ON DELETE CASCADE ON UPDATE CASCADE,
63
    FOREIGN KEY(search_field_id) REFERENCES search_field(id)
63
    FOREIGN KEY(search_field_id) REFERENCES search_field(id)
64
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
64
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
65
65
Lines 294-300 INSERT INTO `elasticsearch_mapping` (`indexname`, `mapping`, `facet`, `suggestib Link Here
294
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'marc21', marc21, facet, suggestible, sort from elasticsearch_mapping where marc21 is not null;
294
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'marc21', marc21, facet, suggestible, sort from elasticsearch_mapping where marc21 is not null;
295
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'unimarc', unimarc, facet, suggestible, sort from elasticsearch_mapping where unimarc is not null;
295
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'unimarc', unimarc, facet, suggestible, sort from elasticsearch_mapping where unimarc is not null;
296
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'normarc', normarc, facet, suggestible, sort from elasticsearch_mapping where normarc is not null;
296
insert into search_marc_map(index_name, marc_type, marc_field, facet, suggestible, sort) select distinct indexname, 'normarc', normarc, facet, suggestible, sort from elasticsearch_mapping where normarc is not null;
297
insert into search_field (name, type) select distinct mapping, type from elasticsearch_mapping;
297
insert into search_field (name, label, type) select distinct mapping, mapping, type from elasticsearch_mapping;
298
298
299
insert into search_marc_to_field(search_marc_map_id, search_field_id) select search_marc_map.id,search_field.id from search_field, search_marc_map, elasticsearch_mapping where elasticsearch_mapping.mapping=search_field.name AND elasticsearch_mapping.marc21=search_marc_map.marc_field AND search_marc_map.marc_type='marc21' AND indexname='biblios' AND index_name='biblios';
299
insert into search_marc_to_field(search_marc_map_id, search_field_id) select search_marc_map.id,search_field.id from search_field, search_marc_map, elasticsearch_mapping where elasticsearch_mapping.mapping=search_field.name AND elasticsearch_mapping.marc21=search_marc_map.marc_field AND search_marc_map.marc_type='marc21' AND indexname='biblios' AND index_name='biblios';
300
insert into search_marc_to_field(search_marc_map_id, search_field_id) select search_marc_map.id,search_field.id from search_field, search_marc_map, elasticsearch_mapping where elasticsearch_mapping.mapping=search_field.name AND elasticsearch_mapping.unimarc=search_marc_map.marc_field AND search_marc_map.marc_type='unimarc' AND indexname='biblios' AND index_name='biblios';
300
insert into search_marc_to_field(search_marc_map_id, search_field_id) select search_marc_map.id,search_field.id from search_field, search_marc_map, elasticsearch_mapping where elasticsearch_mapping.mapping=search_field.name AND elasticsearch_mapping.unimarc=search_marc_map.marc_field AND search_marc_map.marc_type='unimarc' AND indexname='biblios' AND index_name='biblios';
301
- 

Return to bug 14899