root/lang/perl/Senna/trunk/lib/Senna/Records.pm @ 4024

Revision 4024, 1.2 kB (checked in by daisuke, 7 years ago)

lang/perl/Senna; docs for records

  • Property svn:keywords set to Id
RevLine 
[3937]1# $Id$
2#
3# Copyright (c) 2005-2008 Daisuke Maki <daisuke@endeworks.jp>
4# All rights reserved.
5
6package Senna::Records;
7use strict;
8use warnings;
9
10sub next
11{
12    my $self = shift;
13    my $record = $self->_XS_next;
14    if ($record && wantarray) {
15        return ($record->key, $record->score);
16    }
17    return $record;
18}
19
201;
[3955]21
22__END__
23
24=head1 NAME
25
26Senna::Records - A Collection Of Records (sen_records)
27
28=head1 METHODS
29
[4024]30=head2 open
31
32=head2 close
33
[3955]34=head2 next
35
36=head2 curr_key
37
38=head2 nhits
39
[3962]40=head2 sort
41
42Sorts the records, discarding results if the total number of records
43exceed C<limit>.
44
45  $records->sort($limit);
46
47If you want to control the sort order (ascending/descending), specify a
48second argument which can be a HASHREF
49
50  $records->sort($limit, { mode => SEN_SORT_ASCENDING });
51  $records->sort($limit, { mode => SEN_SORT_DESCENDING });
52
[3963]53Beware, though, that according to the senna documentation, by specifying
54not sort options the results are sorted by I<score> (descending), and if you
55specify the mode (without any compar args), the results are sorted by the
56I<key>s.
57
[3962]58Please note that the custom comparison operator is currently not supported.
59Patched welcome!
60
[3955]61=cut
Note: See TracBrowser for help on using the browser.