1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
namespace Swader\Diffbot\Entity;
|
4
|
|
|
|
5
|
|
|
use Swader\Diffbot\Abstracts\Entity;
|
6
|
|
|
|
7
|
|
|
class SearchInfo extends Entity
|
8
|
|
|
{
|
9
|
|
|
|
10
|
|
|
/**
|
11
|
|
|
* Should always return "searchInfo"
|
12
|
|
|
* @return string
|
13
|
|
|
*/
|
14
|
|
|
public function getType()
|
15
|
|
|
{
|
16
|
|
|
return $this->data['searchInfo'];
|
17
|
|
|
}
|
18
|
|
|
|
19
|
|
|
/**
|
20
|
|
|
* Current UTC time as timestamp
|
21
|
|
|
* @return int
|
22
|
|
|
*/
|
23
|
1 |
|
public function getCurrentTimeUTC()
|
24
|
|
|
{
|
25
|
1 |
|
return (int)$this->data['currentTimeUTC'];
|
26
|
|
|
}
|
27
|
|
|
|
28
|
|
|
/**
|
29
|
|
|
* Response time in milliseconds. Time it took to process the query on
|
30
|
|
|
* Diffbot's end.
|
31
|
|
|
* @return int
|
32
|
|
|
*/
|
33
|
1 |
|
public function getResponseTimeMS()
|
34
|
|
|
{
|
35
|
1 |
|
return (int)$this->data['responseTimeMS'];
|
36
|
|
|
}
|
37
|
|
|
|
38
|
|
|
/**
|
39
|
|
|
* Number of results skipped for any reason
|
40
|
|
|
* @todo: find out why results might be omitted
|
41
|
|
|
* @return int
|
42
|
|
|
*/
|
43
|
1 |
|
public function getNumResultsOmitted()
|
44
|
|
|
{
|
45
|
1 |
|
return (int)$this->data['numResultsOmitted'];
|
46
|
|
|
}
|
47
|
|
|
|
48
|
|
|
/**
|
49
|
|
|
* Number of skipped shards
|
50
|
|
|
* @todo: find out what shards are
|
51
|
|
|
* @return int
|
52
|
|
|
*/
|
53
|
1 |
|
public function getNumShardsSkipped()
|
54
|
|
|
{
|
55
|
1 |
|
return (int)$this->data['numShardsSkipped'];
|
56
|
|
|
}
|
57
|
|
|
|
58
|
|
|
/**
|
59
|
|
|
* Total number of shards
|
60
|
|
|
* @todo: find out what shards are
|
61
|
|
|
* @return int
|
62
|
|
|
*/
|
63
|
1 |
|
public function getTotalShards()
|
64
|
|
|
{
|
65
|
1 |
|
return (int)$this->data['totalShards'];
|
66
|
|
|
}
|
67
|
|
|
|
68
|
|
|
/**
|
69
|
|
|
* Total number of documents in collection.
|
70
|
|
|
* Should resemble the total number you got on the crawl job.
|
71
|
|
|
* @todo: find out why not identical
|
72
|
|
|
* @return int
|
73
|
|
|
*/
|
74
|
1 |
|
public function getDocsInCollection()
|
75
|
|
|
{
|
76
|
1 |
|
return (int)$this->data['docsInCollection'];
|
77
|
|
|
}
|
78
|
|
|
|
79
|
|
|
/**
|
80
|
|
|
* Number of results that match - NOT the number of *returned* results!
|
81
|
|
|
* @return int
|
82
|
|
|
*/
|
83
|
1 |
|
public function getHits()
|
84
|
|
|
{
|
85
|
1 |
|
return (int)$this->data['hits'];
|
86
|
|
|
}
|
87
|
|
|
|
88
|
|
|
/**
|
89
|
|
|
* Returns an assoc. array containing the following keys and example values:
|
90
|
|
|
*
|
91
|
|
|
|
92
|
|
|
"fullQuery" => "type:json AND (author:\"Miles Johnson\" AND type:article)",
|
93
|
|
|
"queryLanguageAbbr" => "xx",
|
94
|
|
|
"queryLanguage" => "Unknown",
|
95
|
|
|
"terms" => [
|
96
|
|
|
[
|
97
|
|
|
"termNum" => 0,
|
98
|
|
|
"termStr" => "Miles Johnson",
|
99
|
|
|
"termFreq" => 2621376,
|
100
|
|
|
"termHash48" => 224575481707228,
|
101
|
|
|
"termHash64" => 4150001371756911641,
|
102
|
|
|
"prefixHash64" => 3732660069076179349
|
103
|
|
|
],
|
104
|
|
|
[
|
105
|
|
|
"termNum" => 1,
|
106
|
|
|
"termStr" => "type:json",
|
107
|
|
|
"termFreq" => 2621664,
|
108
|
|
|
"termHash48" => 272064464231140,
|
109
|
|
|
"termHash64" => 9877301297136722857,
|
110
|
|
|
"prefixHash64" => 7586288672657224048
|
111
|
|
|
],
|
112
|
|
|
[
|
113
|
|
|
"termNum" => 2,
|
114
|
|
|
"termStr" => "type:article",
|
115
|
|
|
"termFreq" => 524448,
|
116
|
|
|
"termHash48" => 210861560163398,
|
117
|
|
|
"termHash64" => 12449358332005671483,
|
118
|
|
|
"prefixHash64" => 7586288672657224048
|
119
|
|
|
]
|
120
|
|
|
]
|
121
|
|
|
|
122
|
|
|
* @todo: find out what hashes are, and to what the freq is relative
|
123
|
|
|
* @return array
|
124
|
|
|
*/
|
125
|
1 |
|
public function getQueryInfo()
|
126
|
|
|
{
|
127
|
1 |
|
return (array)$this->data['queryInfo'];
|
128
|
|
|
}
|
129
|
|
|
|
130
|
|
|
} |