1 | <?php |
||
14 | class Index |
||
15 | { |
||
16 | /** |
||
17 | * @var LuceneIndex |
||
18 | */ |
||
19 | private $index; |
||
20 | |||
21 | /** |
||
22 | * @var string|boolean $path |
||
23 | */ |
||
24 | protected $path; |
||
25 | |||
26 | /** |
||
27 | * @var Filter |
||
28 | */ |
||
29 | protected $filter; |
||
30 | |||
31 | /** |
||
32 | * Index constructor. |
||
33 | * |
||
34 | * @param Filter $filter |
||
35 | */ |
||
36 | 29 | public function __construct(Filter $filter) |
|
40 | |||
41 | /** |
||
42 | * Open |
||
43 | * |
||
44 | * @param string|boolean $path |
||
45 | * @param bool $forceCreate |
||
46 | * @return $this |
||
47 | * @throws ExceptionInterface |
||
48 | * @throws \Exception |
||
49 | */ |
||
50 | 9 | public function open($path = false, $forceCreate = true) |
|
57 | |||
58 | /** |
||
59 | * @param integer $limit |
||
60 | * @return $this |
||
61 | */ |
||
62 | 1 | public function limit($limit) |
|
67 | |||
68 | /** |
||
69 | * Create Index |
||
70 | * |
||
71 | * Extends the Lucene "open" method to create the index if it doesn't exist. |
||
72 | * |
||
73 | * @param string|boolean $path |
||
74 | * @param boolean $forceCreate |
||
75 | * @return SearchIndexInterface |
||
76 | * @throws \Exception |
||
77 | */ |
||
78 | 8 | private function createIndex($path, $forceCreate = true) |
|
92 | |||
93 | /** |
||
94 | * @param $path |
||
95 | */ |
||
96 | 23 | public function setPath($path) |
|
100 | |||
101 | /** |
||
102 | * @return string |
||
103 | * @throws \Exception |
||
104 | */ |
||
105 | 9 | protected function path() |
|
113 | |||
114 | /** |
||
115 | * @return LuceneIndex |
||
116 | */ |
||
117 | 5 | public function get() |
|
121 | } |
||
122 |