|
1
|
|
|
<?php |
|
2
|
|
|
namespace ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Spellchecking; |
|
3
|
|
|
|
|
4
|
|
|
/* |
|
5
|
|
|
* This file is part of the TYPO3 CMS project. |
|
6
|
|
|
* |
|
7
|
|
|
* It is free software; you can redistribute it and/or modify it under |
|
8
|
|
|
* the terms of the GNU General Public License, either version 2 |
|
9
|
|
|
* of the License, or any later version. |
|
10
|
|
|
* |
|
11
|
|
|
* For the full copyright and license information, please read the |
|
12
|
|
|
* LICENSE.txt file that was distributed with this source code. |
|
13
|
|
|
* |
|
14
|
|
|
* The TYPO3 project - inspiring people to share! |
|
15
|
|
|
*/ |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Value object that represent a spellchecking suggestion. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Frans Saris <[email protected]> |
|
21
|
|
|
* @author Timo Hund <[email protected]> |
|
22
|
|
|
* @package ApacheSolrForTypo3\Solr\Domain\Search\ResultSet\Spellchecking |
|
23
|
|
|
*/ |
|
24
|
|
|
class Suggestion |
|
25
|
|
|
{ |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* @var string |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $suggestion = ''; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* @var string |
|
34
|
|
|
*/ |
|
35
|
|
|
protected $missSpelled = ''; |
|
36
|
|
|
|
|
37
|
|
|
/** |
|
38
|
|
|
* @var int |
|
39
|
|
|
*/ |
|
40
|
|
|
protected $numFound = 1; |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* @var int |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $startOffset = 0; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var int |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $endOffset = 0; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* @param string $suggestion the suggested term |
|
54
|
|
|
* @param string $missSpelled the misspelled original term |
|
55
|
|
|
* @param int $numFound |
|
56
|
|
|
* @param int $startOffset |
|
57
|
|
|
* @param int $endOffset |
|
58
|
|
|
*/ |
|
59
|
|
|
public function __construct($suggestion = '', $missSpelled = '', $numFound = 1, $startOffset = 0, $endOffset = 0) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->suggestion = $suggestion; |
|
62
|
|
|
$this->missSpelled = $missSpelled; |
|
63
|
|
|
$this->numFound = $numFound; |
|
64
|
|
|
$this->startOffset = $startOffset; |
|
65
|
|
|
$this->endOffset = $endOffset; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @return int |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getEndOffset() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->endOffset; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return int |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getNumFound() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->numFound; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return int |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getStartOffset() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->startOffset; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return string |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSuggestion() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->suggestion; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getMissSpelled() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->missSpelled; |
|
106
|
|
|
} |
|
107
|
|
|
} |
|
108
|
|
|
|