Bugzilla – Attachment 59946 Details for
Bug 17169
Add facets for ccode to elasticsearch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17169: Add a facet for ccode fields to ElasticSearch
Bug-17169-Add-a-facet-for-ccode-fields-to-ElasticS.patch (text/plain), 4.92 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-02-06 19:51:55 UTC
(
hide
)
Description:
Bug 17169: Add a facet for ccode fields to ElasticSearch
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-02-06 19:51:55 UTC
Size:
4.92 KB
patch
obsolete
>From ebcdc54cd6f99a190a106b160176711ae1aaed69 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 11 Oct 2016 09:01:12 +0000 >Subject: [PATCH] Bug 17169: Add a facet for ccode fields to ElasticSearch > >To test: >1 - Apply patch >2 - Backup your db >3 - Drop and create a new db to ensure your mappings are refreshed from >the patch >4 - add some titles with items with collection codes >5 - search and see collection code facets >6 - sign off > >Work to be done: >1 - Replace codes with descriptions > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + > Koha/SearchEngine/Elasticsearch/Search.pm | 2 +- > admin/searchengine/elasticsearch/mappings.yaml | 9 +++++++++ > koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc | 1 + > koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc | 1 + > 5 files changed, 13 insertions(+), 1 deletion(-) > >diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >index 5946a272ac..fbd4370b64 100644 >--- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >+++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm >@@ -118,6 +118,7 @@ sub build_query { > location => { terms => { field => "location__facet" } }, > 'su-geo' => { terms => { field => "su-geo__facet" } }, > se => { terms => { field => "se__facet" } }, >+ ccode => { terms => { field => "ccode__facet" } }, > }; > > my $display_library_facets = C4::Context->preference('DisplayLibraryFacets'); >diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm >index ee38daec17..c3cdb15dad 100644 >--- a/Koha/SearchEngine/Elasticsearch/Search.pm >+++ b/Koha/SearchEngine/Elasticsearch/Search.pm >@@ -146,7 +146,6 @@ sub search_compat { > $servers, $results_per_page, $offset, $expanded_facet, > $branches, $query_type, $scan > ) = @_; >- > my %options; > $options{offset} = $offset; > $options{expanded_facet} = $expanded_facet; >@@ -408,6 +407,7 @@ sub _convert_facets { > 'su-geo' => { order => 4, label => 'Places', }, > se => { order => 5, label => 'Series', }, > subject => { order => 6, label => 'Topics', }, >+ ccode => { order => 7, label => 'CollectionCodes',}, > holdingbranch => { order => 8, label => 'HoldingLibrary' }, > homebranch => { order => 9, label => 'HomeLibrary' } > ); >diff --git a/admin/searchengine/elasticsearch/mappings.yaml b/admin/searchengine/elasticsearch/mappings.yaml >index 50582a8b4e..8d3fec429d 100644 >--- a/admin/searchengine/elasticsearch/mappings.yaml >+++ b/admin/searchengine/elasticsearch/mappings.yaml >@@ -1255,6 +1255,15 @@ biblios: > sort: ~ > suggestible: '' > type: '' >+ ccode: >+ label: collection-code >+ mappings: >+ - facet: '1' >+ marc_field: '9528' >+ marc_type: marc21 >+ sort: ~ >+ suggestible: '' >+ type: '' > control-number: > label: control-number > mappings: >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index 3d0d15e036..887c38c919 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >@@ -20,6 +20,7 @@ > [% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %] > [% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %] > [% IF facets_loo.type_label_Location %]<span id="facet-locations">Locations</span>[% END %] >+[% IF facets_loo.type_label_CollectionCodes %]<span id="facet-locations">Collections</span>[% END %] > <ul> > [% SET url = "/cgi-bin/koha/catalogue/search.pl?" _ query_cgi _ limit_cgi %] > [% IF ( sort_by ) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >index e83243e598..b1505b7c61 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >@@ -24,6 +24,7 @@ > [% IF facets_loo.type_label_Places %]<h5 id="facet-places">Places</h5>[% END %] > [% IF facets_loo.type_label_Series %]<h5 id="facet-series">Series</h5>[% END %] > [% IF facets_loo.type_label_ItemTypes %]<h5 id="facet-itemtypes">Item types</h5>[% END %] >+ [% IF facets_loo.type_label_CollectionCodes %]<h5 id="facet-itemtypes">Collections</h5>[% END %] > [% UNLESS singleBranchMode %] > [% IF ( facets_loo.type_label_HomeLibrary ) %]<span id="facet-home-libraries">Home libraries</span>[% END %] > [% IF ( facets_loo.type_label_HoldingLibrary ) %]<span id="facet-holding-libraries">Holding libraries</span>[% END %] >-- >2.11.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17169
:
56141
|
59946
|
59947
|
60354
|
60664
|
60741
|
60890
|
60891
|
60892