/usr/share/perl5/SRU/Response/Term.pm is in libsru-perl 1.01-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | package SRU::Response::Term;
{
$SRU::Response::Term::VERSION = '1.01';
}
#ABSTRACT: A class for representing terms in a Scan response
use strict;
use warnings;
use SRU::Utils qw( error );
use SRU::Utils::XML qw( element elementNoEscape );
use base qw( Class::Accessor );
sub new {
my ($class, %args) = @_;
return error( "must supply value parameter in call to new()" )
if ! exists $args{value};
return $class->SUPER::new( \%args );
}
SRU::Response::Term->mk_accessors( qw(
value
numberOfRecords
displayTerm
whereInList
extraTermData
) );
sub asXML {
my $self = shift;
return
elementNoEscape( 'term',
element( 'value', $self->value() ) .
element( 'numberOfRecords', $self->numberOfRecords() ) .
element( 'displayTerm', $self->displayTerm() ) .
element( 'whereInList', $self->whereInList() ) .
elementNoEscape( 'extraTermData', $self->extraTermData() )
);
}
1;
__END__
=pod
=head1 NAME
SRU::Response::Term - A class for representing terms in a Scan response
=head1 SYNOPSIS
=head1 DESCRIPTION
A SRU::Response::Term object bundles up information about a single
term contained in a SRU::Response::Scan object. A scan object can
contain multiple term objects.
=head1 METHODS
=head2 new()
THe constructor which you must at least pass the value parameter:
my $term = SRU::Response::Term->new( term => "Foo Fighter" );
In addition you can pass the numberOfRecords, displayTerm, whereInList,
and extraTermData parameters, or set them separately with their
accessors.
=cut
=head2 value()
The term exactly as it appears in the index. This term should be able to be
sent in a query as is to retrieve the records it derives from.
=head2 numberOfRecords()
The number of records which would be matched if the index in the request's
scanClause was searched with the term in the 'value' field.
=head2 displayTerm()
A string to display to the end user in place of the term itself. For example
this might add back in stopwords which do not appear in the index, or diacritics
which have been normalised.
=head2 whereInList()
A flag to indicate the position of the term within the complete term list. It
must be one of the following values: 'first' (the first term), 'last' (the last
term), 'only' (the only term) or 'inner' (any other term).
=head2 extraTermData()
Additional profile specific information. More details are available in the
extensions section.
=cut
=head2 asXML()
=cut
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Ed Summers.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|