first reimport from platal
[platal.git] / include / exalead / exalead.class.php
1 <?php
2
3
4 class ExaleadData{
5
6 var $query;
7 var $groups = array();
8 var $hits = array();
9 var $spellings = array();
10 var $keywords = array();
11
12 var $nhits = "";
13 var $nmatches = "";
14 var $estimated = false;
15 var $last = "";
16 var $start = "";
17 var $end = "";
18
19 function ExaleadData(){}
20
21 function setQuery($query){$this->query = $query;}
22 function addHit($hit){$this->hits[] = $hit;}
23 function addGroup($group){$this->groups[] = $group;}
24 function addSpelling($spelling){$this->spellings[] = $spelling;}
25 function addKeyword($keyword){$this->keywords[] = $keyword;}
26 }
27
28 class ExaleadKeyword{
29 var $name = "";
30 var $display = "";
31 var $count = "";
32 var $automatic = "";
33 var $refine_href = "";
34 var $exclude_href = "";
35 var $reset_href = "";
36
37 function ExaleadKeyword(){}
38 function clear(){
39 $name = "";
40 $display = "";
41 $count = "";
42 $automatic = "";
43 $refine_href = "";
44 $exclude_href = "";
45 $reset_href = "";
46 }
47
48 function is_normal(){
49 return empty($this->reset_href);
50 }
51
52 function is_refined(){
53 return ( (!empty($this->reset_href)) && ($this->count > 0) );
54 }
55
56 function is_excluded(){
57 return ( (!empty($this->reset_href)) && ($this->count == 0) );
58 }
59
60 }
61
62 class ExaleadGroup{
63
64 var $gid = "";
65 var $categories = array();
66 var $title = "";
67 var $clipped = false;
68 var $count = "";
69 var $browsed = false;
70 var $clip_href = "";
71 var $reset_href = "";
72
73 function ExaleadGroup(){}
74
75 function addCategory($category){
76 $this->categories[] = $category;
77 }
78
79 function setGid($gid){$this->gid = $gid;}
80 function setTitle($title){$this->title = $title;}
81 function setClipped($clipped){$this->clipped = $clipped;}
82 function setCount($count){$this->count = $count;}
83 function setBrowsed($browsed){$this->browsed = $browsed;}
84 function setClipHref($clip_href){$this->clip_href = $clip_href;}
85 function setResetHref($reset_href){$this->reset_href = $reset_href;}
86
87 function clear(){
88 $this->gid = "";
89 $this->categories = array();
90 $this->title = "";
91 $this->clipped = false;
92 $this->count = "";
93 $this->browsed = false;
94 $this->clip_href = "";
95 $this->reset_href = "";
96 }
97
98 }
99
100 class ExaleadSpelling{
101
102 var $display = "";
103 var $query_href = "";
104
105 function ExaleadSpelling(){}
106
107 function setDisplay($display){$this->display = $display;}
108 function setQueryHref($query_href){$this->query_href = $query_href;}
109
110 function clear(){
111 $this->display = "";
112 $this->query_href = "";
113 }
114 }
115
116 class ExaleadCategory{
117 var $name = "";
118 var $display = "";
119 var $count = "";
120 var $automatic = false;
121 var $refine_href = "";
122 var $exclude_href = "";
123 var $reset_href = "";
124 var $cref = "";
125 var $gid = "";
126 var $gcount = "";
127 var $categories = array();
128
129 function ExaleadCategory(){}
130
131 function addCategory($category){
132 $this->categories[] = $category;
133 }
134
135 function clear(){
136 $this->name = "";
137 $this->display = "";
138 $this->count = "";
139 $this->automatic = false;
140 $this->refine_href = "";
141 $this->exclude_href = "";
142 $this->reset_href = "";
143 $this->cref = "";
144 $this->gid = "";
145 $this->gcount = "";
146 }
147
148 function is_normal(){
149 return empty($this->reset_href);
150 }
151
152 function is_refined(){
153 return ( (!empty($this->reset_href)) && ($this->count > 0) );
154 }
155
156 function is_excluded(){
157 return ( (!empty($this->reset_href)) && ($this->count == 0) );
158 }
159
160 }
161
162 class ExaleadHit{
163 var $hitfields = array();
164 var $hitgroups = array();
165 var $actions = array();
166 var $score = "";
167 var $url = "";
168
169 function ExaleadHit(){}
170
171 function addHitField($hitfield){$this->hitfields[] = $hitfield;}
172 function addHitGroup($hitgroup){$this->hitgroups[] = $hitgroup;}
173 function addAction($action){$this->actions[] = $action;}
174
175 function clear(){
176 $this->hitfields = array();
177 $this->hitgroups = array();
178 $this->actions = array();
179 $this->score = "";
180 $this->url = "";
181 }
182 }
183
184 class ExaleadHitGroup{
185 var $hitcategories = array();
186 var $title = '';
187 var $gid = '';
188
189 function ExaleadHitGroup(){}
190
191 function addHitCategory($hitcategory){$this->hitcategories[] = $hitcategory;}
192
193 function clear(){
194 $this->hitcategories = array();
195 $this->title = '';
196 $this->gid = '';
197 }
198 }
199
200 class ExaleadHitCategory{
201 var $name = '';
202 var $display = '';
203 var $cref = '';
204 var $gid = '';
205 var $browseHref = '';
206
207 function ExaleadHitCategory(){}
208
209 function clear(){
210 $this->name = '';
211 $this->display = '';
212 $this->cref = '';
213 $this->gid = '';
214 $this->browseHref = '';
215 }
216 }
217
218 class ExaleadHitField{
219 var $text_segments = array();
220 var $has_text_cut = false;
221 var $name = "";
222 var $value = "";
223
224 function ExaleadHitField(){}
225
226 function addTextSegment($text_segment){$this->text_segments[] = $text_segment;}
227 function setHasTextCut($has_text_cut){$this->has_text_cut = $has_text_cut;}
228
229 function clear(){
230 $this->text_segments = array();
231 $this->has_text_cut = false;
232 $this->name = "";
233 $this->value = "";
234 }
235 }
236
237 class ExaleadAction{
238 var $display;
239 var $kind;
240 var $execHref;
241
242 function ExaleadAction(){}
243
244 function clear(){
245 $this->display = '';
246 $this->kind = '';
247 $this->execHref = '';
248 }
249 }
250
251 class ExaleadTextSegment{
252 var $text = "";
253 var $highlighted = false;
254
255 function ExaleadTextSegment(){
256 }
257
258 function setHighlighted($highlighted){$this->highlighted = $highlighted;}
259
260 function append($text){
261 $this->text .= $text;
262 }
263
264 function clear(){
265 $this->text = "";
266 $this->highlighted = false;
267 }
268 }
269
270 class ExaleadQuery{
271 var $query_parameters = array();
272 var $query_terms = array();
273 var $query = "";
274 var $context = "";
275 var $time = "";
276 var $interrupted = false;
277 var $browsed = false;
278
279 function ExaleadQuery(){}
280
281 function addParameter($parameter){$this->query_parameters[] = $parameter;}
282 function addTerm($term){$this->query_terms[] = $term;}
283
284 function clear(){
285 $this->query_parameters = array();
286 $this->query_terms = array();
287 $this->query = "";
288 $this->context = "";
289 $this->time = "";
290 $this->interrupted = false;
291 $this->browsed = false;
292 }
293 }
294
295 class ExaleadQueryParameter{
296
297 var $name = "";
298 var $value = "";
299
300 function ExaleadQueryParameter(){}
301
302 function clear(){
303 $this->name = "";
304 $this->value = "";
305 }
306 }
307
308 class ExaleadQueryTerm{
309
310 var $level = "";
311 var $regexp = "";
312
313 function ExaleadQueryTerm(){}
314
315 function clear(){
316 $this->regexp = "";
317 $this->level = "";
318 }
319 }
320
321
322 ?>