|
Revision 4024, 1.2 kB
(checked in by daisuke, 5 years ago)
|
|
lang/perl/Senna; docs for records
|
-
Property svn:keywords set to
Id
|
| Rev | Line | |
|---|
| [3937] | 1 | # $Id$ |
|---|
| 2 | # |
|---|
| 3 | # Copyright (c) 2005-2008 Daisuke Maki <daisuke@endeworks.jp> |
|---|
| 4 | # All rights reserved. |
|---|
| 5 | |
|---|
| 6 | package Senna::Records; |
|---|
| 7 | use strict; |
|---|
| 8 | use warnings; |
|---|
| 9 | |
|---|
| 10 | sub 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 | |
|---|
| 20 | 1; |
|---|
| [3955] | 21 | |
|---|
| 22 | __END__ |
|---|
| 23 | |
|---|
| 24 | =head1 NAME |
|---|
| 25 | |
|---|
| 26 | Senna::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 | |
|---|
| 42 | Sorts the records, discarding results if the total number of records |
|---|
| 43 | exceed C<limit>. |
|---|
| 44 | |
|---|
| 45 | $records->sort($limit); |
|---|
| 46 | |
|---|
| 47 | If you want to control the sort order (ascending/descending), specify a |
|---|
| 48 | second 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] | 53 | Beware, though, that according to the senna documentation, by specifying |
|---|
| 54 | not sort options the results are sorted by I<score> (descending), and if you |
|---|
| 55 | specify the mode (without any compar args), the results are sorted by the |
|---|
| 56 | I<key>s. |
|---|
| 57 | |
|---|
| [3962] | 58 | Please note that the custom comparison operator is currently not supported. |
|---|
| 59 | Patched welcome! |
|---|
| 60 | |
|---|
| [3955] | 61 | =cut |
|---|