Bugzilla – Attachment 60818 Details for
Bug 18098
Add an index with the count of not onloan items
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18098: Add an index with the count of not onloan items
Bug-18098-Add-an-index-with-the-count-of-not-onloa.patch (text/plain), 7.22 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-03-03 21:54:40 UTC
(
hide
)
Description:
Bug 18098: Add an index with the count of not onloan items
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-03-03 21:54:40 UTC
Size:
7.22 KB
patch
obsolete
>From 99ce5775c8430ca9f80e50720671901d664c7fb5 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 3 Mar 2017 18:32:06 -0300 >Subject: [PATCH] Bug 18098: Add an index with the count of not onloan items > >This patch adds a numeric index 'not-onloan-count' containing the value >of 999$x. This subfield is filled by 'rebuild_zebra.pl' by making use of >(bug's 18208) 'EmbedItemsAvailability' filter. > >bib1.att and indexes definitions are updated accordingly. > >To test: >- Apply the patch >- Pick the right biblio-zebra-indexdefs.xsl file for your setup and > replace the one your Zebra uses [1] >- Replace your bib1.att >- Replace your ccl.properties >- Have at least one record with more than one item, checkout some > item(s) from that record(s). >- Rebuild zebra's indexes: > $ sudo koha-shell kohadev > k$ cd kohaclone > k$ misc/migration_tools/rebuild_zebra.pl -r -b -v -k > (notice the dump directory is kept, you can try the XSLT yourself > running: > $ xsltproc \ > etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl \ > /tmp/the_dump_dir/biblios/exported_records | less >=> SUCCESS: There are records with the not-onloan-count index, and the > value is correct! >- Check Zebra yourself: > $ yaz-client unix:/var/run/koha/kohadev/bibliosocket > Z> base biblios > Z> find @attr 1=9013 @attr 2=5 @attr 4=109 0 >=> SUCCESS: The search matches the amount of records with not-onloan > items. > Z> s 1+1 >=> SUCCESS: Records with 999$x having a value higher than 0 are rendered >- Sign off :-D > >Note: While this work is complete on its purpose, it is part of an >attempt to create a better way of filtering by availability. > >Sponsored-by: ByWater Solutions > > [1] In kohadevbox this would be >/etc/koha/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >--- > etc/zebradb/biblios/etc/bib1.att | 1 + > etc/zebradb/ccl.properties | 1 + > .../marc21/biblios/biblio-koha-indexdefs.xml | 4 ++++ > .../marc21/biblios/biblio-zebra-indexdefs.xsl | 7 +++++++ > .../normarc/biblios/biblio-koha-indexdefs.xml | 4 ++++ > .../unimarc/biblios/biblio-koha-indexdefs.xml | 4 ++++ > misc/migration_tools/rebuild_zebra.pl | 23 ++++++++++++++-------- > 7 files changed, 36 insertions(+), 8 deletions(-) > >diff --git a/etc/zebradb/biblios/etc/bib1.att b/etc/zebradb/biblios/etc/bib1.att >index 5ebc316615..7acdc1816b 100644 >--- a/etc/zebradb/biblios/etc/bib1.att >+++ b/etc/zebradb/biblios/etc/bib1.att >@@ -220,6 +220,7 @@ att 9009 cn-prefix > att 9010 cn-suffix > att 9011 Suppress > att 9012 Identifier-other >+att 9013 not-onloan-count > > # Items Index > att 8001 withdrawn >diff --git a/etc/zebradb/ccl.properties b/etc/zebradb/ccl.properties >index 27def12871..a1ea690c43 100644 >--- a/etc/zebradb/ccl.properties >+++ b/etc/zebradb/ccl.properties >@@ -994,6 +994,7 @@ date-entered-on-file 1=date-entered-on-file > extent 1=Extent > llength 1=llength > Summary 1=Summary >+not-onloan-count 1=9013 4=109 > > ### > # Items Index >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >index 355a6e3f9c..b67da4193a 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-koha-indexdefs.xml >@@ -1370,6 +1370,10 @@ > <target_index>Note:p</target_index> > </index_subfields> > >+ <index_subfields tag="999" subfields="x"> >+ <target_index>not-onloan-count:n</target_index> >+ </index_subfields> >+ > <facet tag="100" subfields="a"> > <target_index>au:0</target_index> > </facet> >diff --git a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >index c63bd5eeb2..035d3bcb47 100644 >--- a/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >+++ b/etc/zebradb/marc_defs/marc21/biblios/biblio-zebra-indexdefs.xsl >@@ -1242,6 +1242,13 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) > </z:index> > </xslo:if> > </xslo:for-each> >+ <xslo:for-each select="marc:subfield"> >+ <xslo:if test="contains('x', @code)"> >+ <z:index name="not-onloan-count:n"> >+ <xslo:value-of select="."/> >+ </z:index> >+ </xslo:if> >+ </xslo:for-each> > </xslo:template> > <xslo:template mode="index_subfields" match="marc:datafield[@tag='942']"> > <xslo:for-each select="marc:subfield"> >diff --git a/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml >index dff2d7514e..7d2cf08ef0 100644 >--- a/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/normarc/biblios/biblio-koha-indexdefs.xml >@@ -969,6 +969,10 @@ > <target_index>itype:w</target_index> > </index_subfields> > >+ <index_subfields tag="999" subfields="x"> >+ <target_index>not-onloan-count:n</target_index> >+ </index_subfields> >+ > <facet tag="100" subfields="a"> > <target_index>au:0</target_index> > </facet> >diff --git a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >index 90e92a04d3..7c550f80c7 100644 >--- a/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >+++ b/etc/zebradb/marc_defs/unimarc/biblios/biblio-koha-indexdefs.xml >@@ -1444,6 +1444,10 @@ > <target_index>totalissues:s</target_index> > </index_subfields> > >+ <index_subfields tag="999" subfields="x"> >+ <target_index>not-onloan-count:n</target_index> >+ </index_subfields> >+ > <facet tag="225" subfields="a"> > <target_index>se:0</target_index> > </facet> >diff --git a/misc/migration_tools/rebuild_zebra.pl b/misc/migration_tools/rebuild_zebra.pl >index 3b2cb43326..f8750d96a1 100755 >--- a/misc/migration_tools/rebuild_zebra.pl >+++ b/misc/migration_tools/rebuild_zebra.pl >@@ -635,19 +635,26 @@ sub generate_deleted_marc_records { > } > > sub get_corrected_marc_record { >- my ($record_type, $record_number) = @_; >+ my ( $record_type, $record_number ) = @_; > >- my $marc = get_raw_marc_record($record_type, $record_number); >+ my $marc = get_raw_marc_record( $record_type, $record_number ); > >- if (defined $marc) { >+ if ( defined $marc ) { > fix_leader($marc); >- if ($record_type eq 'authority') { >- fix_authority_id($marc, $record_number); >- } elsif ($record_type eq 'biblio' && C4::Context->preference('IncludeSeeFromInSearches')) { >- my $normalizer = Koha::RecordProcessor->new( { filters => 'EmbedSeeFromHeadings' } ); >+ if ( $record_type eq 'authority' ) { >+ fix_authority_id( $marc, $record_number ); >+ } >+ elsif ( $record_type eq 'biblio' ) { >+ >+ my @filters; >+ push @filters, 'EmbedItemsAvailability'; >+ push @filters, 'IncludeSeeFromInSearches' >+ if C4::Context->preference('IncludeSeeFromInSearches'); >+ >+ my $normalizer = Koha::RecordProcessor->new( { filters => \@filters } ); > $marc = $normalizer->process($marc); > } >- if (C4::Context->preference("marcflavour") eq "UNIMARC") { >+ if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) { > fix_unimarc_100($marc); > } > } >-- >2.12.0
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 18098
:
60123
|
60818
|
60859
|
63112