line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#-*- Mode: CPerl -*- |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
## File: DDC::HitList.pm |
4
|
|
|
|
|
|
|
## Author: Bryan Jurish |
5
|
|
|
|
|
|
|
## Description: |
6
|
|
|
|
|
|
|
## + DDC Query utilities: query response structure |
7
|
|
|
|
|
|
|
##====================================================================== |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package DDC::HitList; |
10
|
26
|
|
|
26
|
|
10113
|
use DDC::Hit; |
|
26
|
|
|
|
|
65
|
|
|
26
|
|
|
|
|
706
|
|
11
|
26
|
|
|
26
|
|
153
|
use strict; |
|
26
|
|
|
|
|
53
|
|
|
26
|
|
|
|
|
3157
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
##====================================================================== |
14
|
|
|
|
|
|
|
## Globals |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
##====================================================================== |
17
|
|
|
|
|
|
|
## Constructors, etc. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
## $hits = $CLASS_OR_OBJ->new(%args) |
20
|
|
|
|
|
|
|
## + %$hits, %args: |
21
|
|
|
|
|
|
|
## ( |
22
|
|
|
|
|
|
|
## hits_ => \@hits, ##-- ARRAY-ref of DDC::Hit objects |
23
|
|
|
|
|
|
|
## |
24
|
|
|
|
|
|
|
## ##-- administrative data returned by DDC server (from ConcordDmnLib/Corpora.cpp: CDDCServerListenHost::ProcessSocketString()) |
25
|
|
|
|
|
|
|
## istatus_ => $InternalError, ##-- int InternalError (0=success) |
26
|
|
|
|
|
|
|
## nstatus_ => $NetworkError, ##-- int iNetworkError (0=success) |
27
|
|
|
|
|
|
|
## end_ => $EndHitNo, ##-- DWORD EndHitNo |
28
|
|
|
|
|
|
|
## nhits_ => $HitsCount, ##-- DWORD HitsCount |
29
|
|
|
|
|
|
|
## ndocs_ => $DocsCount, ##-- DWORD RelevantDocsCount |
30
|
|
|
|
|
|
|
## dhits_ => $HitDistribution, ##-- string N1+N2+N3+...+NN=N* |
31
|
|
|
|
|
|
|
## ddocs_ => $DocDistribution, ##-- string N1+N2+N3+...+NN=N* |
32
|
|
|
|
|
|
|
## error_ => $errorMessage, ##-- error message if $hits->{istatus_}!=0 or $hits->{nstatus_}!=0 (empty: success) |
33
|
|
|
|
|
|
|
## ) |
34
|
|
|
|
|
|
|
sub new { |
35
|
0
|
|
|
0
|
1
|
|
my $that = shift; |
36
|
0
|
|
0
|
|
|
|
return bless { |
37
|
|
|
|
|
|
|
hits_=>[], |
38
|
|
|
|
|
|
|
@_ |
39
|
|
|
|
|
|
|
}, ref($that)||$that; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
## $hits = $hits->expandFields() |
43
|
|
|
|
|
|
|
## $hits = $hits->expandFields(\@fieldNames) |
44
|
|
|
|
|
|
|
## + just calls $hit->expandFields() on every hit in $hits->{hits_} |
45
|
|
|
|
|
|
|
sub expandFields { |
46
|
0
|
|
|
0
|
0
|
|
my ($hl,$names) = @_; |
47
|
0
|
0
|
|
|
|
|
$_->expandFields($names) foreach (@{$hl->{hits_}||[]}); |
|
0
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $hl; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
## $thingy = $obj->TO_JSON() |
52
|
|
|
|
|
|
|
## + annoying wrapper for JSON, JSON::XS |
53
|
|
|
|
|
|
|
sub TO_JSON { |
54
|
0
|
|
|
0
|
0
|
|
return { %{$_[0]} }; |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; ##-- be happy |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |