From c9b09051e741ef7e74368e4c1ad52bdb0b7c32f4 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 10 Oct 2013 18:31:02 +0000 Subject: [PATCH] Bug 8252: (follow-up) add basic UNIMARC indexing tests MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds a few basic search and indexing tests for UNIMARC, using sample data provied by Frédéric Demians. The new tests by no means completely cover the possibilities, but should be considered a starting point for future tests. To test: [1] Verify that prove -v t/db_dependent/Search.t passes. Signed-off-by: Galen Charlton --- t/db_dependent/Search.t | 44 +++++++++++++++++-- .../zebraexport/biblio/exported_records | 1 + 2 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 t/db_dependent/data/unimarc/zebraexport/biblio/exported_records diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index af435165e8..ed8ab5daa3 100644 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -12,7 +12,7 @@ use YAML; use C4::Debug; require C4::Context; -use Test::More tests => 162; +use Test::More tests => 172; use Test::MockModule; use MARC::Record; use File::Spec; @@ -112,7 +112,7 @@ sub mock_marcfromkohafield { my $marc_type = shift; if ($marc_type eq 'marc21') { $contextmodule->mock('marcfromkohafield', sub { - my %hash = ( + return { '' => { 'biblio.biblionumber' => [ '999', 'c' ], 'items.barcode' => ['952', 'p' ], @@ -150,8 +150,7 @@ sub mock_marcfromkohafield { 'items.uri' => ['952', 'u' ], 'items.withdrawn' => ['952', '0' ] } - ); - return \%hash; + }; }); } } @@ -671,7 +670,44 @@ sub run_marc21_search_tests { cleanup(); } +sub run_unimarc_search_tests { + my $indexing_mode = shift; + $datadir = tempdir(); + system(dirname(__FILE__) . "/zebra_config.pl $datadir unimarc $indexing_mode"); + + mock_marcfromkohafield('unimarc'); + my $context = new C4::Context("$datadir/etc/koha-conf.xml"); + $context->set_context(); + + use_ok('C4::Search'); + + # set search syspreferences to a known starting point + $QueryStemming = 0; + $QueryAutoTruncate = 0; + $QueryWeightFields = 0; + $QueryFuzzy = 0; + $QueryRemoveStopwords = 0; + $UseQueryParser = 0; + $marcflavour = 'UNIMARC'; + + index_sample_records_and_launch_zebra($datadir, $indexing_mode, 'unimarc'); + + my ( $error, $marcresults, $total_hits ) = SimpleSearch("ti=Järnvägarnas efterfrågan och den svenska industrin", 0, 10); + is($total_hits, 1, 'UNIMARC title search'); + ( $error, $marcresults, $total_hits ) = SimpleSearch("ta=u", 0, 10); + is($total_hits, 1, 'UNIMARC target audience = u'); + ( $error, $marcresults, $total_hits ) = SimpleSearch("ta=k", 0, 10); + is($total_hits, 4, 'UNIMARC target audience = k'); + ( $error, $marcresults, $total_hits ) = SimpleSearch("ta=m", 0, 10); + is($total_hits, 3, 'UNIMARC target audience = m'); + + cleanup(); +} + run_marc21_search_tests('grs1'); run_marc21_search_tests('dom'); +run_unimarc_search_tests('grs1'); +run_unimarc_search_tests('dom'); + 1; diff --git a/t/db_dependent/data/unimarc/zebraexport/biblio/exported_records b/t/db_dependent/data/unimarc/zebraexport/biblio/exported_records new file mode 100644 index 0000000000..bb83d4034d --- /dev/null +++ b/t/db_dependent/data/unimarc/zebraexport/biblio/exported_records @@ -0,0 +1 @@ +01687cam0a2200517 45000010006000000050017000060090010000230100018000330200017000510350021000680350016000890350029001050350018001340350016001520350015001680900010001830990040001931000041002331010008002741020007002821050018002891060006003072000081003132100059003942150026004532250033004792250034005123000086005463280034006324100066006666060026007326060036007586070027007946800016008217000021008378010022008588010025008808010020009058010021009258010030009468010018009768010018009949170030010129300038010429950089010804150020121002234012.0002179466 a91-24-21383-7 aFRb57200220 a(OCoLC)462804551 aAIC10830305 aPRITEC.CAEN.020830971001 afrBN012055727 aocm12427225 asib1081136 a41500 b2004-07-03d0tLIVREv1c2012-06-26 a19740101d1971 u y0frey50 ba0 aswe aSE ay zz 00|z| ar1 aJärnvägarnas efterfrågan och den svenska industrin, 1860-1914fHans Modig aStockholm, Göteborg, Lund, Läromedelsförlagend1971 a195 p.cillus.d22 cm0 aEkonomisk-historiska studier0 aScandinavian university books aEkonomisk-historiska studier. 8. ̱Résumé en anglais. ̱Bibliogr. pp. 140-145 0bThèsecSc. éconeLundd1971 9800039476197tUppsala studies in economic historyx0346-6493 aRailroadsySweden2lc aRailroads and stateySweden2lc aSwedenxIndustries2lc aHE3187b.M6 1aModigbHans4070 1aFRbAICc20020419 1aFRbPRITECc20010514 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20080318gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129778133aaaxx 5352382101:129778133b352382101ju f-1538881030968143cBU20kTR UPSAL 1971/31d2012-06-22o0eMAGrDPNx0bBUgM2s002232cam0a2200601 45000010006000000050017000060090010000230200017000330210021000500350021000710350016000920350022001080350030001300350029001600350031001890350028002200350018002480350016002660350016002820350015002980350016003130900010003290990040003391000041003791010008004201020007004281050018004351060006004532000081004592100032005402150050005723200034006223280068006566000091007246000057008156750032008726760011009046800019009157000042009347120058009768010022010348010020010568010021010768010030010978010018011278010018011459170030011639300038011939950096012319950096013279950096014239950111015194150120121002234012.000217961X aFRb07003332 aFRbD.L. 70-3332 a(OCoLC)419458613 aAIC12910139 aDYNIX_BUNAN_80256 aPRITEC.DIJON.010260153001 aPRITEC.METZ.010010804001 aPRITEC.ROUEN2.170011809001 aPRITECCFLSH010270247001 afrBN012055894 alet11303171 aocm00419634 asib1258139 aurouen58783 a41501 b2004-07-03d0tTHESEv1c2012-06-26 a19700101d1969 k y0frey50 ba0 afre aFR ay va 001yy ar1 aRichard Wagner et la pensée schopenhaueriennebTexte impriméfEdouard Sans aPariscC. Klincksieckd1969 a1 vol. (479 p.)cill., portr. en couv.d24 cm aBibliogr. p. [443]-462. Index 0zEd. commerciale debThèse de doctoratcLettreseRennes 2d1973 13027128032aSchopenhauerbArthurf1788-18603027791246xInfluence2rameau922850945552 13027191451aWagnerbRichardf1813-18832rameau925224 a830 1̧8 ̧Wagner (R.) 1.06 a780.92 aML410.W19bS16 13027122093aSansbÉdouard4070922599023054447658aUniversité de Haute-Bretagne42959165931 1aFRbAICc19990830 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20111212gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129841021aaaxx 5352382101:129841021b352382101ju f02827678191030968144cBU20kTR RENNES 1973/2/1/2d2012-06-22o0eMAGrDPNx3bBUgM2s0 f02827678261030968145cBU20kTR RENNES 1973/2/1/3d2012-06-22o0eMAGrDPNx2bBUgM2s0 f02827678331030968146cBU20kTR RENNES 1973/2/1/4d2012-06-22o0eMAGrDPNx2bBUgM2s0 f02827678021030968147cBU20kTR RENNES 1973/2/1/1d2012-06-22o0eMAGrDPCx2bBUgM2s0tEXCLU DU PRET02221cam0a2200613 45000010006000000050017000060090010000230100011000330200017000440210021000610350020000820350021001020350030001230350018001530350016001710350015001870350016002020900010002180990040002281000041002681010013003091020007003221050018003291060006003472000110003532100037004632150035005002250035005353040055005703200025006254100062006504540042007126060051007546060049008056060048008546060054009026060057009566060050010136060049010636750017011126760008011296860018011377000057011557020052012128010020012648010021012848010030013058010018013358010018013539170030013719300038014019950078014399950090015174150220121002234012.0002179814 d45 FRF aFRb07205457 aFRbD.L. 72-5457 a(OCoLC)25567996 aAIC145701402AIC aPRITEC.BIUM2.010280226001 afrBN012056423 aocm25567996 asib0577105 aurouen64813 a41502 b2004-07-03d0tLIVREv1c2012-06-26 a19720101d1972 k y0frey50 ba1 afreceng aFR ay az 000yy ar1 aLangage et maladies mentalesbTexte impriméfpar Harold J. Vettergtraduction française de Aline Mantel aPariscÉditions ESFdimpr. 1972 a1 vol. (214 p.)cgraph.d24 cm2 aHorizons de la psychologiev13 aTrad. de : "Language behavior and psychopathology" aBibliogr. p. 193-214 91300001605186tHorizons de la psychologiex0073-3393v13 tLanguage behavior and psychopathology 3027257797aLangage, Troubles du2rameau928292 3027341534aPsycholinguistique2rameau931798 3027362124aMaladies mentales2rameau932604 3027824802aSchizophrènesxLangage2rameau946856 3028153596aHandicapésxCommunication2rameau952379 3040730662aTroubles du langage2fmesh9152859 3040767507aPsycholinguistique2fmesh9153279 a1vÉd. 1967 a100 aWM 4752usnlm 1303318254XaVetterbHarold J.f1926-....40709124487 13030778891aMantelbAlinef1934-....4730999100 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20120306gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129886815aaaxx 5352382101:129886815b352382101ju f008884A1030968148cBU20kS 6474d2012-06-22o0eMAGrDPNx9bBUgSs0 f02825140621030968149cHUM20k401.9 VETd2012-06-22o0eSALrDPNx11bHUMgPSYSs002099cam0a2200589 45000010006000000050017000060090010000230100014000330350020000470350021000670350021000880350016001090350030001250350018001550350016001730350015001890350017002040900010002210990040002311000041002711010013003121020007003251050018003321060006003502000141003562100059004972150039005562250031005953200024006264100062006504540056007126000053007686000031008216060042008526060033008946760008009276800010009357000058009457020055010037020049010588010028011078010032011358010020011678010021011878010030012088010018012388010018012569170030012749300038013049950078013429950089014204150320121002234012.0002179822 bbr.d38 F a(OCoLC)28152561 a0620610899sudoc a0719171609sudoc aAIC10370136 aPRITEC.BIUM2.010251846001 afrBN012056430 aocm28152561 asib1109772 aurouen127931 a41503 b2004-07-03d0tLIVREv1c2012-06-26 a19730101d1972 m y0frey50 ba1 afreceng aFR aa az 000zb ar1 aKurt LewinbTexte impriméesa vie et son oeuvrefpar Alfred J. Marrowgtrad. de l'américain par Hélène Costantini et Alex Mucchielli aPariscÉditions ESFd1972e07-Aubenasgimpr. Lienhart a1 vol. (224 p.-[1] f)cill.d24 cm1 aHorizons de la psychologie aBibliogr. p.190-194 91400001605186tHorizons de la psychologiex0073-3393v14 tThe practical theorist, life and work of Kurt Lewin 13028764013aLewinbKurtf1890-19472rameau967385 1aLewinbKurtf1890-19472lc 3027346900aPsychologie2rameau931990 aPsychologistsxBiography2lc a921 aHM251 1303358706XaMarrowbAlfred Jayf1905-....40709128255 13027041794aMucchiellibAlexf1943-....4730919249 13080654355aCostantinibHélène47309223505 0aFRb141182101c19971124 0aFRbDroit-Sc. Ecoc19970911 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20110504gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129762113aaaxx 5352382101:129762113b352382101ju f00896561030968150cBU20kS 4848d2012-06-22o0eMAGrDPNx2bBUgSs0 f02837366921030968151cAPS20k302.3 MARd2012-06-22o0eSALrDPNx1bAPSgBSSSs002065cam0a2200565 45000010006000000050017000060090010000230100014000330200017000470210021000640350020000850350029001050350029001340350030001630350018001930350016002110350016002270350015002430350016002580900010002740990040002841000041003241010008003651020007003731050018003801060006003982000108004042100064005122150027005762250035006033040043006383200034006814100057007154540166007726060055009386800010009937000062010037020049010658010020011148010020011348010021011548010021011758010030011968010018012268010018012449170030012629300038012929950079013309950090014094150420121002234012.0002179830 bBr.d30 F aFRb07407567 aFRbD.L. 74-7567 a(OCoLC)28003430 aPRITEC.INRP.010130707001 aPRITEC.INRP.020731730001 aPRITEC.ROUEN.120024012001 afrBN01205647X aocm27423258 aocm28003430 asib0625107 aurouen52816 a41504 b2004-07-03d0tLIVREv1c2012-06-26 a19740101d1973 k y0frey50 ba0 afre aFR ay a 001yy ar1 aLe concept de motivationbTexte impriméfpar R.S. Petersgtraduit de l'anglais par Hélène Costantini aPariscÉditions ESFdimpr. 1973e07-Aubenas impr. Lienhart a1 vol. (134 p.)d24 cm2 aHorizons de la psychologiev18 aTraduit de : The concept of motivation aBibliogr. p. [127]-129. Index 0001605186tHorizons de la psychologiex0073-3393v18 0007832451tThe concept of motivationfby R. S. Peterse2nd edcLondonnRoutledge & Kegan PaulnHumanities pressd1967p166 psStudies in philosophical psychology 302729188XaMotivation (psychologie)2rameau929808 aBF683 13030141338aPetersbRichard Stanleyf1919-....4070989671 13080654355aCostantinibHélène47309223505 1aUSbOCLCgAACR2 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 2aFRbAUROCgAFNOR 3aFRbAbesc20120413gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:12980424Xaaaxx 5352382101:12980424Xb352382101ju f10926451030968152cBU20kS 5122d2012-06-22o0eMAGrDPNx19bBUgSs0 f02825158851030968153cHUM20k153.8 PETd2012-06-22o0eSALrDPNx43bHUMgPSYSs002310cam0a2200649 45000010006000000050017000060090010000230100017000330200017000500210026000670350021000930350021001140350021001350350023001560350023001790350030002020350029002320350018002610350016002790350015002950900010003100990041003201000041003611010013004021020007004151050018004221060006004402000133004462100048005792150027006272250040006543000044006944100062007384540033008005170045008336060047008786060046009256060041009716060021010126060024010336750017010576760008010747000058010827020050011408010020011908010021012108010030012318010018012618010018012799150033012979170030013309170030013609300054013909300048014449950084014929950084015764150520121002234012.0002179849 dLe vol. 29 F aFRb07003681 aFRbD.L. 70-3681-3682 a(OCoLC)421714637 a0527268439sudoc aAIC126200842AIC aDYNIX_BUNAN_119062 aDYNIX_BUNAN_119063 aPRITEC.BIUM2.010270153001 aPRITEC.INRP.010141223001 afrBN012056494 aocm14419606 asib0580634 a41505 a12b2009-10-26d0tLIVREc2012-06-26 a19700101d1970 m y0frey50 ba1 afreceng aFR ay zz 00|zy ar1 aLa relation d'aide et la psychothérapiebTexte impriméfpar Carl Rogersgtrad. en français par J.P. [Jean Pierre] Zigliara... aPariscÉditions sociales françaisesd1970 a2 vol. (461 p.)d24 cm1 aHorizons de la psychologiev1, I-II aTrad. de : Counseling and psychotherapy 0001605186tHorizons de la psychologiex0073-3393v1, I-II tCounseling and psychotherapy aLa relation d'aide et la psychothérapie 3027243710aNon directivité2rameau927519 3027352382aPsychothérapie2rameau932203 302941587XaCounseling2rameau979112 aCounseling2mesh aPsychotherapy2mesh a1vÉd. 1967 a100 1302710608XaRogersbCarl Ransomf1902-19874070921954 13067391532aZigliarabJean-Pierre47309193259 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20120307gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:263608689b0066717 5352382101:263608689aauuu 5352382101:263608697aauuu 5352382101:263608689b352382101aS 6186/1jsgM150 5352382101:263608697b352382101aS 6186/2js f00667171030968154cBU20kS 6186/1d2012-06-22hPSY12o0eMAGrDPNx1bBUs0 f16013181030968155cBU20kS 6186/2d2012-06-22hPSY12o0eMAGrDPNx1bBUs001951cam0a2200577 45000010006000000050017000060090010000230100016000330200017000490210022000660350021000880350021001090350021001300350029001510350032001800350018002120350016002300350015002460350016002610900010002770990040002871000041003271010013003681020007003811050018003881060006004062000138004122100041005502150027005912250031006183040056006493200010007054100053007154540041007686060058008096060054008676060053009216760011009746800010009856860030009957000053010257020042010788010020011208010021011408010030011618010018011918010018012099170030012279300038012579950078012954150620121002234012.0002179865 bBr.d23 FRF aFRb07019321 aFRbD.L. 70-19321 a(OCoLC)299790367 a0134454649sudoc aAIC030701612AIC aPRITEC.INRP.020381616001 aPRITEC.STRASBG.040012419001 afrBN01205652X aocm14493330 asib0560653 aurouen29753 a41506 b2004-07-03d0tLIVREv1c2012-06-26 a19710101d1970 k y0frey50 ba1 afreceng aFR ay ||||001yy ar1 aL'action pédagogique sur les attitudes et les intérêtsbTexte impriméfpar K. M. Evans,...gtraduit de l'anglais par René Dutour aPariscles Éditions ESFdimpr. 1970 a1 vol. (150 p.)d24 cm0 aHorizons de la psychologie aTraduit de : "Attitudes and interests in education" aIndex 0001605186tHorizons de la psychologiex0073-3393 tAttitudes and interests in education 3027241688aPsychologie de l'éducation2rameau927382 3027291928aIntérêt (psychologie)2rameau929810 3027489515aAttitude (psychologie)2rameau937079 a370.15 aBF721 aLB 1065bE92a 19702usnlm 13096310227aEvansbKathleen Marianne40709244305 13096310286aDutourbRené47309244306 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20080204gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129645389aaaxx 5352382101:129645389b352382101ju f12194431030968156cBU20kS 6319d2012-06-22o0eMAGrDPNx2bBUgSs001858cam0a2200481 45000010006000000050017000060090010000230200017000330210021000500350021000710350022000920350029001140350018001430350016001610350015001770900010001920990040002021000041002421010008002831020007002911050018002981060006003162000156003222100034004782150047005126060062005596060052006216060088006736060076007616060070008376060082009076060039009896060032010287000055010608010020011158010021011358010030011568010018011868010018012049170030012229300038012529950086012904150720121002234012.000217992X aFRb07005056 aFRbD.L. 70-5056 a(OCoLC)299659206 aDYNIX_BUCAY_56100 aPRITEC.INRP.010060440001 afrBN012056715 aocm01867266 asib0505137 a41507 b2004-07-03d0tLIVREv1c2012-06-26 a19700101d1970 m y0frey50 ba0 afre aFR ay ||||000yy ar1 aL'école ouvertebTexte impriméetémoignages et propositions pour aider à la mise en place d'une éducation permanente et populairefBernard Éliade aPariscÉd. du SeuildDL 1970 a1 vol. (251 p.)ccouv. ill. en noird21 cm 302725447XaEnseignementxTravail de groupe2rameau928127 3027276538aÉducation permanente2rameau929160 3027288714aEnseignementxMéthodes actives3027226794yFrance2rameau929663926455 3027303128aÉducation et État3027226794yFrance2rameau930299926455 3027310485aEnseignementxMéthodes expérimentales2rameau930594 3027327752aEnseignementxInnovations3027226794yFrance2rameau931309926455 aActivity programs in education2lc aGroup work in education2lc 13026849747aÉliadebBernardf1938-....4070911229 1aUSbOCLCgAACR2 2aFRbAUROCgAFNOR 3aFRbAbesc20100924gAFNOR 3aFRbBNgAFNOR 3aFRbSFgAFNOR 5352382101:129922617aaaxx 5352382101:129922617b352382101ju f02825186951030968157cHUM20kM 1530d2012-06-22o0eMAGrDPNx7bHUMgPSYEs0 \ No newline at end of file -- 2.39.5