| 1 | # Licensed to the Apache Software Foundation (ASF) under one or more | ||||||||||
| 2 | # contributor license agreements. See the NOTICE file distributed with | ||||||||||
| 3 | # this work for additional information regarding copyright ownership. | ||||||||||
| 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 | ||||||||||
| 5 | # (the "License"); you may not use this file except in compliance with | ||||||||||
| 6 | # the License. You may obtain a copy of the License at | ||||||||||
| 7 | # | ||||||||||
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 9 | # | ||||||||||
| 10 | # Unless required by applicable law or agreed to in writing, software | ||||||||||
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||
| 13 | # See the License for the specific language governing permissions and | ||||||||||
| 14 | # limitations under the License. | ||||||||||
| 15 | |||||||||||
| 16 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | package LucyX::Search::MockMatcher; | ||||||||||
| 20 | 9 | ▶ | use Lucy; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 9 | our $VERSION = '0.008000'; | |||||||||
| 22 | 9 | $VERSION = eval $VERSION; | |||||||||
| 23 | |||||||||||
| 24 | 3763 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 25 | 3763 | my ( $either, %args ) = @_; | |||||||||
| 26 | 3763 | ▶ | confess("Missing doc_ids") unless ref( $args{doc_ids} ) eq 'ARRAY'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 3763 | my $doc_ids = Lucy::Object::I32Array->new( ints => $args{doc_ids} ); | |||||||||
| 28 | 3763 | my $size = $doc_ids->get_size; | |||||||||
| 29 | 3763 | my $scores; | |||||||||
| 30 | 3763 | ▶ | if ( ref( $args{scores} ) eq 'ARRAY' ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | confess("Mismatch between scores and doc_ids array sizes") | ||||||||||
| 32 | 3762 | ▶ | unless scalar @{ $args{scores} } == $size; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | $scores = Clownfish::Blob->new( | ||||||||||
| 34 | 3762 | pack( "f$size", @{ $args{scores} } ) ); | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | 3763 | return $either->_new( | |||||||||
| 38 | doc_ids => $doc_ids, | ||||||||||
| 39 | scores => $scores, | ||||||||||
| 40 | ); | ||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | 9 | 1; | |||||||||
| 44 | |||||||||||
| 45 | __END__ | ||||||||||