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

(-)a/t/db_dependent/Search.t (-68 / +44 lines)
Lines 144-191 $contextmodule->mock('queryparser', sub { Link Here
144
    return $QParser;
144
    return $QParser;
145
});
145
});
146
146
147
sub mock_marcfromkohafield {
147
our $bibliomodule = new Test::MockModule('C4::Biblio');
148
149
sub mock_GetMarcSubfieldStructure {
148
    my $marc_type = shift;
150
    my $marc_type = shift;
149
    if ($marc_type eq 'marc21') {
151
    if ($marc_type eq 'marc21') {
150
        $contextmodule->mock('marcfromkohafield', sub {
152
        $bibliomodule->mock('GetMarcSubfieldStructure', sub {
151
            return {
153
            return {
152
                '' => {
154
                    'biblio.biblionumber' => { tagfield =>  '999', tagsubfield => 'c' },
153
                    'biblio.biblionumber' => [ '999', 'c' ],
155
                    'biblio.isbn' => { tagfield => '020', tagsubfield => 'a' },
154
                    'items.barcode' => ['952', 'p' ],
156
                    'biblio.title' => { tagfield => '245', tagsubfield => 'a' },
155
                    'items.booksellerid' => ['952', 'e' ],
157
                    'biblio.notes' => { tagfield => '500', tagsubfield => 'a' },
156
                    'items.ccode' => ['952', '8' ],
158
                    'items.barcode' => { tagfield => '952', tagsubfield => 'p' },
157
                    'items.cn_sort' => ['952', '6' ],
159
                    'items.booksellerid' => { tagfield => '952', tagsubfield => 'e' },
158
                    'items.cn_source' => ['952', '2' ],
160
                    'items.ccode' => { tagfield => '952', tagsubfield => '8' },
159
                    'items.coded_location_qualifier' => ['952', 'f' ],
161
                    'items.cn_sort' => { tagfield => '952', tagsubfield => '6' },
160
                    'items.copynumber' => ['952', 't' ],
162
                    'items.cn_source' => { tagfield => '952', tagsubfield => '2' },
161
                    'items.damaged' => ['952', '4' ],
163
                    'items.coded_location_qualifier' => { tagfield => '952', tagsubfield => 'f' },
162
                    'items.dateaccessioned' => ['952', 'd' ],
164
                    'items.copynumber' => { tagfield => '952', tagsubfield => 't' },
163
                    'items.datelastborrowed' => ['952', 's' ],
165
                    'items.damaged' => { tagfield => '952', tagsubfield => '4' },
164
                    'items.datelastseen' => ['952', 'r' ],
166
                    'items.dateaccessioned' => { tagfield => '952', tagsubfield => 'd' },
165
                    'items.enumchron' => ['952', 'h' ],
167
                    'items.datelastborrowed' => { tagfield => '952', tagsubfield => 's' },
166
                    'items.holdingbranch' => ['952', 'b' ],
168
                    'items.datelastseen' => { tagfield => '952', tagsubfield => 'r' },
167
                    'items.homebranch' => ['952', 'a' ],
169
                    'items.enumchron' => { tagfield => '952', tagsubfield => 'h' },
168
                    'items.issues' => ['952', 'l' ],
170
                    'items.holdingbranch' => { tagfield => '952', tagsubfield => 'b' },
169
                    'items.itemcallnumber' => ['952', 'o' ],
171
                    'items.homebranch' => { tagfield => '952', tagsubfield => 'a' },
170
                    'items.itemlost' => ['952', '1' ],
172
                    'items.issues' => { tagfield => '952', tagsubfield => 'l' },
171
                    'items.itemnotes' => ['952', 'z' ],
173
                    'items.itemcallnumber' => { tagfield => '952', tagsubfield => 'o' },
172
                    'items.itemnumber' => ['952', '9' ],
174
                    'items.itemlost' => { tagfield => '952', tagsubfield => '1' },
173
                    'items.itype' => ['952', 'y' ],
175
                    'items.itemnotes' => { tagfield => '952', tagsubfield => 'z' },
174
                    'items.location' => ['952', 'c' ],
176
                    'items.itemnumber' => { tagfield => '952', tagsubfield => '9' },
175
                    'items.materials' => ['952', '3' ],
177
                    'items.itype' => { tagfield => '952', tagsubfield => 'y' },
176
                    'items.nonpublicnote' => ['952', 'x' ],
178
                    'items.location' => { tagfield => '952', tagsubfield => 'c' },
177
                    'items.notforloan' => ['952', '7' ],
179
                    'items.materials' => { tagfield => '952', tagsubfield => '3' },
178
                    'items.onloan' => ['952', 'q' ],
180
                    'items.nonpublicnote' => { tagfield => '952', tagsubfield => 'x' },
179
                    'items.price' => ['952', 'g' ],
181
                    'items.notforloan' => { tagfield => '952', tagsubfield => '7' },
180
                    'items.renewals' => ['952', 'm' ],
182
                    'items.onloan' => { tagfield => '952', tagsubfield => 'q' },
181
                    'items.replacementprice' => ['952', 'v' ],
183
                    'items.price' => { tagfield => '952', tagsubfield => 'g' },
182
                    'items.replacementpricedate' => ['952', 'w' ],
184
                    'items.renewals' => { tagfield => '952', tagsubfield => 'm' },
183
                    'items.reserves' => ['952', 'n' ],
185
                    'items.replacementprice' => { tagfield => '952', tagsubfield => 'v' },
184
                    'items.restricted' => ['952', '5' ],
186
                    'items.replacementpricedate' => { tagfield => '952', tagsubfield => 'w' },
185
                    'items.stack' => ['952', 'j' ],
187
                    'items.reserves' => { tagfield => '952', tagsubfield => 'n' },
186
                    'items.uri' => ['952', 'u' ],
188
                    'items.restricted' => { tagfield => '952', tagsubfield => '5' },
187
                    'items.withdrawn' => ['952', '0' ]
189
                    'items.stack' => { tagfield => '952', tagsubfield => 'j' },
188
                    }
190
                    'items.uri' => { tagfield => '952', tagsubfield => 'u' },
191
                    'items.withdrawn' => { tagfield => '952', tagsubfield => '0' },
189
                };
192
                };
190
        });
193
        });
191
    }
194
    }
Lines 196-202 sub run_marc21_search_tests { Link Here
196
    $datadir = tempdir();
199
    $datadir = tempdir();
197
    system(dirname(__FILE__) . "/zebra_config.pl $datadir marc21 $indexing_mode");
200
    system(dirname(__FILE__) . "/zebra_config.pl $datadir marc21 $indexing_mode");
198
201
199
    mock_marcfromkohafield('marc21');
202
    mock_GetMarcSubfieldStructure('marc21');
200
    my $context = new C4::Context("$datadir/etc/koha-conf.xml");
203
    my $context = new C4::Context("$datadir/etc/koha-conf.xml");
201
    $context->set_context();
204
    $context->set_context();
202
205
Lines 219-250 sub run_marc21_search_tests { Link Here
219
    is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported");
222
    is(scalar(grep(/^ti$/, @$indexes)), 1, "Title index supported");
220
223
221
    my $bibliomodule = new Test::MockModule('C4::Biblio');
224
    my $bibliomodule = new Test::MockModule('C4::Biblio');
222
    $bibliomodule->mock('_get_inverted_marc_field_map', sub {
223
        my %hash = (
224
            '' => {
225
                '245' => { 'sfs' => { 'a' => [ [ 'biblio', 'title' ] ], 'b' => [ [ 'bibliosubtitle', 'subtitle' ] ] },
226
                    'list' => [ [ 'a', 'biblio', 'title' ], [ 'b', 'bibliosubtitle', 'subtitle' ] ]
227
                },
228
                '100' => {
229
                    'sfs' => { 'a' => [ [ 'biblio', 'author' ] ] },
230
                    'list' => [ [ 'a', 'biblio', 'author' ] ]
231
                },
232
                '999' => {
233
                    'sfs' => { 'c' => [ [ 'biblio', 'biblionumber' ] ], 'd' => [ [ 'biblioitems', 'biblioitemnumber' ] ] },
234
                    'list' => [ [ 'd', 'biblioitems', 'biblioitemnumber' ], [ 'c', 'biblio', 'biblionumber' ] ]
235
                },
236
                '020' => {
237
                    'sfs' => { 'a' => [ [ 'biblioitems', 'isbn' ] ] },
238
                    'list' => [ [ 'a', 'biblioitems', 'isbn' ] ]
239
                },
240
                '500' => {
241
                    'sfs' => { 'a' => [ [ 'biblioitems', 'notes' ] ] },
242
                    'list' => [ [ 'a', 'biblioitems', 'notes' ] ]
243
                },
244
            }
245
        );
246
        return \%hash;
247
    });
248
225
249
    my %branches = (
226
    my %branches = (
250
        'CPL' => { 'branchaddress1' => 'Jefferson Summit', 'branchcode' => 'CPL', 'branchname' => 'Centerville', },
227
        'CPL' => { 'branchaddress1' => 'Jefferson Summit', 'branchcode' => 'CPL', 'branchname' => 'Centerville', },
Lines 883-889 sub run_unimarc_search_tests { Link Here
883
    $datadir = tempdir();
860
    $datadir = tempdir();
884
    system(dirname(__FILE__) . "/zebra_config.pl $datadir unimarc $indexing_mode");
861
    system(dirname(__FILE__) . "/zebra_config.pl $datadir unimarc $indexing_mode");
885
862
886
    mock_marcfromkohafield('unimarc');
863
    mock_GetMarcSubfieldStructure('unimarc');
887
    my $context = new C4::Context("$datadir/etc/koha-conf.xml");
864
    my $context = new C4::Context("$datadir/etc/koha-conf.xml");
888
    $context->set_context();
865
    $context->set_context();
889
866
890
- 

Return to bug 17201