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

(-)a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm (-22 / +103 lines)
Lines 477-492 sub _convert_sort_fields { Link Here
477
477
478
    # Turn the sorting into something we care about.
478
    # Turn the sorting into something we care about.
479
    my %sort_field_convert = (
479
    my %sort_field_convert = (
480
        acqdate     => 'acqdate',
480
        acqdate     => 'Date-of-acquisition',
481
        author      => 'author',
481
        author      => 'Author',
482
        call_number => 'callnum',
482
        call_number => 'Local-classification',
483
        popularity  => 'issues',
483
        popularity  => 'issues',
484
        relevance   => undef,       # default
484
        relevance   => undef,       # default
485
        title       => 'title',
485
        title       => 'Title',
486
        pubdate     => 'pubdate',
486
        pubdate     => 'Date-of-publication',
487
    );
488
    my %sort_order_convert = (
489
        dsc => 'desc',
490
        asc => 'asc',
491
        az => 'asc',
492
        za => 'desc',
487
    );
493
    );
488
    my %sort_order_convert =
489
      ( qw( dsc desc ), qw( asc asc ), qw( az asc ), qw( za desc ) );
490
494
491
    # Convert the fields and orders, drop anything we don't know about.
495
    # Convert the fields and orders, drop anything we don't know about.
492
    grep { $_->{field} } map {
496
    grep { $_->{field} } map {
Lines 513-532 types. Link Here
513
=cut
517
=cut
514
518
515
our %index_field_convert = (
519
our %index_field_convert = (
516
    'kw'      => '_all',
520
    'kw' => '_all',
517
    'ti'      => 'title',
521
    'ab' => 'Abstract',
518
    'au'      => 'author',
522
    'au' => 'Author',
519
    'su'      => 'subject',
523
    'lcn' => 'Local-classification',
520
    'nb'      => 'isbn',
524
    'callnum' => 'Local-classification',
521
    'se'      => 'title-series',
525
    'ln' => 'language',
522
    'callnum' => 'callnum',
526
    'Record-type' => 'rtype',
523
    'itype'   => 'itype',
527
    'mc-rtype' => 'rtype',
524
    'ln'      => 'ln',
528
    'mus' => 'rtype',
525
    'branch'  => 'homebranch',
529
    'ctype' => 'Content-type',
526
    'fic'     => 'lf',
530
    'lc-card' => 'LC-card-number',
527
    'mus'     => 'rtype',
531
    'sn' => 'Local-number',
528
    'aud'     => 'ta',
532
    'yr' => 'Date-of-publication',
529
    'hi'      => 'Host-Item-Number',
533
    'pubdate' => 'Date-of-publication',
534
    'acqdate' => 'Date-of-acquisition',
535
    'Date-time-last-modified' => 'Date/time-last-modified',
536
    'dtlm' => 'Date/time-last-modified',
537
    'diss' => 'Dissertation-information',
538
    'ean' => 'EAN',
539
    'nb' => 'ISBN',
540
    'isbn' => 'ISBN',
541
    'ns' => 'ISSN',
542
    'issn' => 'ISSN',
543
    'Music-number' => 'Identifier-publisher-for-music',
544
    'Number-music-publisher' => 'Identifier-publisher-for-music',
545
    'music' => 'Identifier-publisher-for-music',
546
    'ident' => 'Identifier-standard',
547
    'name' => 'Name',
548
    'cpn' => 'Corporate-name',
549
    'cfn' => 'Conference-name',
550
    'pl' => 'Place-publication',
551
    'pn' => 'Personal-name',
552
    'pb' => 'Publisher',
553
    'pv' => 'Provider',
554
    'nt' => 'Note',
555
    'notes' => 'Note',
556
    'rcn' => 'Record-control-number',
557
    'su' => 'Subject',
558
    'su-to' => 'Subject',
559
    #'su-geo' => 'Subject',
560
    'su-ut' => 'Subject',
561
    'ti' => 'Title',
562
    'se' => 'Title-series',
563
    'ut' => 'Title-uniform',
564
    'an' => 'Authority-Number',
565
    'Koha-Auth-Number' => 'Authority-Number',
566
    'at' => 'authtype',
567
    'he' => 'Heading',
568
    'rank' => 'relevance',
569
    'phr' => 'st-phrase',
570
    'wrdl' => 'st-word-list',
571
    'rt' => 'right-Truncation',
572
    'rtrn' => 'right-Truncation',
573
    'ltrn' => 'left-Truncation',
574
    'rltrn' => 'left-and-right',
575
    'mc-itemtype' => 'itemtype',
576
    'mc-ccode' => 'ccode',
577
    'branch' => 'homebranch',
578
    'mc-loc' => 'location',
579
    'stocknumber' => 'Number-local-acquisition',
580
    'inv' => 'Number-local-acquisition',
581
    'bc' => 'barcode',
582
    'mc-itype' => 'itype',
583
    'aub' => 'Author-personal-bibliography',
584
    'auo' => 'Author-in-order',
585
    'ff8-22' => 'ta',
586
    'aud' => 'ta',
587
    'audience' => 'ta',
588
    'Frequency-code' => 'ff8-18',
589
    'Illustration-code' => 'ff8-18-21',
590
    'Regularity-code' => 'ff8-19',
591
    'Type-Of-Serial' => 'ff8-21',
592
    'format' => 'ff8-23',
593
    'Conference-code' => 'ff8-29',
594
    'Festschrift-indicator' => 'ff8-30',
595
    'Index-indicator' => 'ff8-31',
596
    'fiction' => 'lf',
597
    'fic' => 'lf',
598
    'Literature-Code' => 'lf',
599
    'biography' => 'bio',
600
    'ff8-34' => 'bio',
601
    'Biography-Code' => 'bio',
602
    'l-format' => 'ff7-01-02',
603
    'lex' => 'lexile-number',
604
    'video-mt' => 'Video-mt',
605
    'Graphic-type' => 'Graphics-type',
606
    'Graphic-support' => 'Graphics-support',
607
    'item' => 'Item',
608
    'hi' => 'Host-Item-Number',
609
    'itu' => 'Index-term-uncontrolled',
610
    'itg' => 'Index-term-genre',
530
);
611
);
531
612
532
sub _convert_index_fields {
613
sub _convert_index_fields {
Lines 547-553 sub _convert_index_fields { Link Here
547
            $f =~ s/^mc-//;
628
            $f =~ s/^mc-//;
548
        }
629
        }
549
        my $r = {
630
        my $r = {
550
            field => $index_field_convert{$f},
631
            field => exists $index_field_convert{$f} ? $index_field_convert{$f} : $f,
551
            type  => $index_type_convert{ $t // '__default' }
632
            type  => $index_type_convert{ $t // '__default' }
552
        };
633
        };
553
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
634
        $r->{field} = ($mc . $r->{field}) if $mc && $r->{field};
(-)a/Koha/SearchEngine/Elasticsearch/Search.pm (-5 / +5 lines)
Lines 425-437 sub _convert_facets { Link Here
425
    # things that zebra uses.
425
    # things that zebra uses.
426
    # TODO let the library define the order using the interface.
426
    # TODO let the library define the order using the interface.
427
    my %type_to_label = (
427
    my %type_to_label = (
428
        author   => { order => 1, label => 'Authors', },
428
        Author => { order => 1, label => 'Authors', },
429
        itype    => { order => 2, label => 'ItemTypes', },
429
        itype => { order => 2, label => 'ItemTypes', },
430
        location => { order => 3, label => 'Location', },
430
        location => { order => 3, label => 'Location', },
431
        'su-geo' => { order => 4, label => 'Places', },
431
        'su-geo' => { order => 4, label => 'Places', },
432
        se       => { order => 5, label => 'Series', },
432
        'Title-series' => { order => 5, label => 'Series', },
433
        subject  => { order => 6, label => 'Topics', },
433
        Subject => { order => 6, label => 'Topics', },
434
        ccode    => { order => 7, label => 'CollectionCodes',},
434
        ccode => { order => 7, label => 'CollectionCodes',},
435
        holdingbranch => { order => 8, label => 'HoldingLibrary' },
435
        holdingbranch => { order => 8, label => 'HoldingLibrary' },
436
        homebranch => { order => 9, label => 'HomeLibrary' }
436
        homebranch => { order => 9, label => 'HomeLibrary' }
437
    );
437
    );
(-)a/admin/searchengine/elasticsearch/mappings.yaml (-55 / +41 lines)
Lines 577-584 biblios: Link Here
577
        sort: ~
577
        sort: ~
578
        suggestible: ''
578
        suggestible: ''
579
    type: string
579
    type: string
580
  acqdate:
580
  Date-of-acquisition:
581
    label: acqdate
581
    label: Date-of-acquisition
582
    mappings:
582
    mappings:
583
      - facet: ''
583
      - facet: ''
584
        marc_field: 952d
584
        marc_field: 952d
Lines 596-603 biblios: Link Here
596
        sort: ~
596
        sort: ~
597
        suggestible: ''
597
        suggestible: ''
598
    type: date
598
    type: date
599
  an:
599
  Authority-Number:
600
    label: an
600
    label: Authority-Number
601
    mappings:
601
    mappings:
602
      - facet: ''
602
      - facet: ''
603
        marc_field: '1009'
603
        marc_field: '1009'
Lines 1120-1127 biblios: Link Here
1120
        sort: ~
1120
        sort: ~
1121
        suggestible: ''
1121
        suggestible: ''
1122
    type: number
1122
    type: number
1123
  author:
1123
  Author:
1124
    label: author
1124
    label: Author
1125
    mappings:
1125
    mappings:
1126
      - facet: '1'
1126
      - facet: '1'
1127
        marc_field: 100a
1127
        marc_field: 100a
Lines 1141-1152 biblios: Link Here
1141
      - facet: 0
1141
      - facet: 0
1142
        marc_field: 245c
1142
        marc_field: 245c
1143
        marc_type: marc21
1143
        marc_type: marc21
1144
        sort: 0
1144
        sort: ~
1145
        suggestible: 0
1145
        suggestible: 0
1146
      - facet: 1
1146
      - facet: 1
1147
        marc_field: 700a
1147
        marc_field: 700a
1148
        marc_type: marc21
1148
        marc_type: marc21
1149
        sort: 0
1149
        sort: ~
1150
        suggestible: 1
1150
        suggestible: 1
1151
      - facet: '1'
1151
      - facet: '1'
1152
        marc_field: 100a
1152
        marc_field: 100a
Lines 1166-1177 biblios: Link Here
1166
      - facet: 0
1166
      - facet: 0
1167
        marc_field: 245c
1167
        marc_field: 245c
1168
        marc_type: normarc
1168
        marc_type: normarc
1169
        sort: 0
1169
        sort: ~
1170
        suggestible: 0
1170
        suggestible: 0
1171
      - facet: 1
1171
      - facet: 1
1172
        marc_field: 700a
1172
        marc_field: 700a
1173
        marc_type: normarc
1173
        marc_type: normarc
1174
        sort: 0
1174
        sort: ~
1175
        suggestible: 1
1175
        suggestible: 1
1176
      - facet: '1'
1176
      - facet: '1'
1177
        marc_field: 200f
1177
        marc_field: 200f
Lines 1186-1197 biblios: Link Here
1186
      - facet: 1
1186
      - facet: 1
1187
        marc_field: 700a
1187
        marc_field: 700a
1188
        marc_type: unimarc
1188
        marc_type: unimarc
1189
        sort: 0
1189
        sort: ~
1190
        suggestible: 1
1190
        suggestible: 1
1191
      - facet: 0
1191
      - facet: 0
1192
        marc_field: '701'
1192
        marc_field: '701'
1193
        marc_type: unimarc
1193
        marc_type: unimarc
1194
        sort: 0
1194
        sort: ~
1195
        suggestible: 0
1195
        suggestible: 0
1196
    type: string
1196
    type: string
1197
  bgf-number:
1197
  bgf-number:
Lines 1241-1260 biblios: Link Here
1241
        sort: ~
1241
        sort: ~
1242
        suggestible: ''
1242
        suggestible: ''
1243
    type: ''
1243
    type: ''
1244
  bnb-card-number:
1245
    label: bnb-card-number
1246
    mappings:
1247
      - facet: ''
1248
        marc_field: '015'
1249
        marc_type: marc21
1250
        sort: ~
1251
        suggestible: ''
1252
      - facet: ''
1253
        marc_field: '015'
1254
        marc_type: normarc
1255
        sort: ~
1256
        suggestible: ''
1257
    type: ''
1258
  ccode:
1244
  ccode:
1259
    label: collection-code
1245
    label: collection-code
1260
    mappings:
1246
    mappings:
Lines 1274-1281 biblios: Link Here
1274
       sort: ~
1260
       sort: ~
1275
       suggestible: ''
1261
       suggestible: ''
1276
    type: ''
1262
    type: ''
1277
  control-number:
1263
  Control-number:
1278
    label: control-number
1264
    label: Control-number
1279
    mappings:
1265
    mappings:
1280
      - facet: ''
1266
      - facet: ''
1281
        marc_field: '001'
1267
        marc_field: '001'
Lines 1481-1488 biblios: Link Here
1481
        sort: ~
1467
        sort: ~
1482
        suggestible: ''
1468
        suggestible: ''
1483
    type: string
1469
    type: string
1484
  identifier-standard:
1470
  Identifier-standard:
1485
    label: identifier-standard
1471
    label: Identifier-standard
1486
    mappings:
1472
    mappings:
1487
      - facet: ''
1473
      - facet: ''
1488
        marc_field: '010'
1474
        marc_field: '010'
Lines 1550-1557 biblios: Link Here
1550
        sort: ~
1536
        sort: ~
1551
        suggestible: ''
1537
        suggestible: ''
1552
    type: ''
1538
    type: ''
1553
  isbn:
1539
  ISBN:
1554
    label: isbn
1540
    label: ISBN
1555
    mappings:
1541
    mappings:
1556
      - facet: ''
1542
      - facet: ''
1557
        marc_field: 020a
1543
        marc_field: 020a
Lines 1655-1662 biblios: Link Here
1655
        sort: ~
1641
        sort: ~
1656
        suggestible: ''
1642
        suggestible: ''
1657
    type: string
1643
    type: string
1658
  lc-cardnumber:
1644
  LC-card-number:
1659
    label: lc-cardnumber
1645
    label: LC-card-number
1660
    mappings:
1646
    mappings:
1661
      - facet: ''
1647
      - facet: ''
1662
        marc_field: '010'
1648
        marc_field: '010'
Lines 1678-1684 biblios: Link Here
1678
        marc_type: unimarc
1664
        marc_type: unimarc
1679
        sort: ~
1665
        sort: ~
1680
        suggestible: ''
1666
        suggestible: ''
1681
    type: ''
1667
        type: ''
1682
  lf:
1668
  lf:
1683
    label: lf
1669
    label: lf
1684
    mappings:
1670
    mappings:
Lines 1712-1719 biblios: Link Here
1712
        sort: ~
1698
        sort: ~
1713
        suggestible: ''
1699
        suggestible: ''
1714
    type: ''
1700
    type: ''
1715
  ln:
1701
  language:
1716
    label: ln
1702
    label: language
1717
    mappings:
1703
    mappings:
1718
      - facet: ''
1704
      - facet: ''
1719
        marc_field: 008_/35-37
1705
        marc_field: 008_/35-37
Lines 1731-1738 biblios: Link Here
1731
        sort: ~
1717
        sort: ~
1732
        suggestible: ''
1718
        suggestible: ''
1733
    type: ''
1719
    type: ''
1734
  local-classification:
1720
  Local-classification:
1735
    label: local-classification
1721
    label: Local-classification
1736
    mappings:
1722
    mappings:
1737
      - facet: ''
1723
      - facet: ''
1738
        marc_field: 952o
1724
        marc_field: 952o
Lines 1877-1884 biblios: Link Here
1877
        sort: ~
1863
        sort: ~
1878
        suggestible: ''
1864
        suggestible: ''
1879
    type: boolean
1865
    type: boolean
1880
  pl:
1866
  Place-publication:
1881
    label: pl
1867
    label: Place-publication
1882
    mappings:
1868
    mappings:
1883
      - facet: ''
1869
      - facet: ''
1884
        marc_field: 008_/15-17
1870
        marc_field: 008_/15-17
Lines 1891-1898 biblios: Link Here
1891
        sort: ~
1877
        sort: ~
1892
        suggestible: ''
1878
        suggestible: ''
1893
    type: ''
1879
    type: ''
1894
  place:
1880
  Place-of-publication:
1895
    label: place
1881
    label: Place-of-publication
1896
    mappings:
1882
    mappings:
1897
      - facet: '1'
1883
      - facet: '1'
1898
        marc_field: 260a
1884
        marc_field: 260a
Lines 1910-1917 biblios: Link Here
1910
        sort: ~
1896
        sort: ~
1911
        suggestible: ''
1897
        suggestible: ''
1912
    type: string
1898
    type: string
1913
  pubdate:
1899
  Date-of-publication:
1914
    label: pubdate
1900
    label: Date-of-publication
1915
    mappings:
1901
    mappings:
1916
      - facet: ''
1902
      - facet: ''
1917
        marc_field: 008_/7-10
1903
        marc_field: 008_/7-10
Lines 1929-1936 biblios: Link Here
1929
        sort: ~
1915
        sort: ~
1930
        suggestible: ''
1916
        suggestible: ''
1931
    type: ''
1917
    type: ''
1932
  publisher:
1918
  Publisher:
1933
    label: publisher
1919
    label: Publisher
1934
    mappings:
1920
    mappings:
1935
      - facet: '1'
1921
      - facet: '1'
1936
        marc_field: 260b
1922
        marc_field: 260b
Lines 1948-1955 biblios: Link Here
1948
        sort: ~
1934
        sort: ~
1949
        suggestible: ''
1935
        suggestible: ''
1950
    type: string
1936
    type: string
1951
  record-source:
1937
  Record-source:
1952
    label: record-source
1938
    label: Record-source
1953
    mappings:
1939
    mappings:
1954
      - facet: ''
1940
      - facet: ''
1955
        marc_field: 008_/39
1941
        marc_field: 008_/39
Lines 1976-1983 biblios: Link Here
1976
        sort: ~
1962
        sort: ~
1977
        suggestible: ''
1963
        suggestible: ''
1978
    type: ''
1964
    type: ''
1979
  se:
1965
  Title-series:
1980
    label: se
1966
    label: Title-series
1981
    mappings:
1967
    mappings:
1982
      - facet: '1'
1968
      - facet: '1'
1983
        marc_field: 440a
1969
        marc_field: 440a
Lines 2024-2031 biblios: Link Here
2024
        sort: ~
2010
        sort: ~
2025
        suggestible: ''
2011
        suggestible: ''
2026
    type: string
2012
    type: string
2027
  subject:
2013
  Subject:
2028
    label: subject
2014
    label: Subject
2029
    mappings:
2015
    mappings:
2030
      - facet: '1'
2016
      - facet: '1'
2031
        marc_field: 600a
2017
        marc_field: 600a
Lines 2286-2293 biblios: Link Here
2286
        sort: ~
2272
        sort: ~
2287
        suggestible: ''
2273
        suggestible: ''
2288
    type: ''
2274
    type: ''
2289
  title:
2275
  Title:
2290
    label: title
2276
    label: Title
2291
    mappings:
2277
    mappings:
2292
      - facet: ''
2278
      - facet: ''
2293
        marc_field: '130'
2279
        marc_field: '130'
(-)a/installer/data/mysql/atomicupdate/bug_19575-use-canonical-field-names-and-resolve-aliased-fields.sql (-1 / +19 lines)
Line 0 Link Here
0
- 
1
UPDATE `search_field` SET `name` = 'Date-of-publication', `label` = 'Date-of-publication' WHERE `name` = 'pubdate';
2
UPDATE `search_field` SET `name` = 'Title-series', `label` = 'Title-series' WHERE `name` = 'se';
3
UPDATE `search_field` SET `name` = 'Identifier-standard', `label` = 'Identifier-standard' WHERE `name` = 'identifier-standard';
4
UPDATE `search_field` SET `name` = 'Author', `label` = 'Author' WHERE `name` = 'author';
5
UPDATE `search_field` SET `name` = 'Control-number', `label` = 'Control-number' WHERE `name` = 'control-number';
6
UPDATE `search_field` SET `name` = 'Place-publication', `label` = 'Place-publication' WHERE `name` = 'pl';
7
UPDATE `search_field` SET `name` = 'Place-of-publication', `label` = 'Place-of-publication' WHERE `name` = 'place';
8
UPDATE `search_field` SET `name` = 'Date-of-acquisition', `label` = 'Date-of-acquisition' WHERE `name` = 'acqdate';
9
UPDATE `search_field` SET `name` = 'ISBN', `label` = 'ISBN' WHERE `name` = 'isbn';
10
UPDATE `search_field` SET `name` = 'BNB-card-number', `label` = 'BNB-card-number' WHERE `name` = 'bnb-card-number';
11
UPDATE `search_field` SET `name` = 'Authority-Number', `label` = 'Authority-Number' WHERE `name` = 'an';
12
UPDATE `search_field` SET `name` = 'language', `label` = 'language' WHERE `name` = 'ln';
13
UPDATE `search_field` SET `name` = 'Subject', `label` = 'Subject' WHERE `name` = 'subject';
14
UPDATE `search_field` SET `name` = 'Publisher', `label` = 'Publisher' WHERE `name` = 'publisher';
15
UPDATE `search_field` SET `name` = 'Record-source', `label` = 'Record-source' WHERE `name` = 'record-source';
16
UPDATE `search_field` SET `name` = 'Title', `label` = 'Title' WHERE `name` = 'title';
17
UPDATE `search_field` SET `name` = 'Local-classification', `label` = 'Local-classification' WHERE `name` = 'local-classification';
18
DELETE FROM `search_field` WHERE `name` = 'bnb-card-number';
19
DELETE FROM `search_field` WHERE `name` = 'lc-cardnumber';

Return to bug 19575