@@ 8-42 (lines=35) @@ | ||
5 | /** |
|
6 | * @see http://wiki.apache.org/solr/UpdateXmlMessages#A.22commit.22_and_.22optimize.22 |
|
7 | */ |
|
8 | class Commit extends Update |
|
9 | { |
|
10 | /** |
|
11 | * @var string |
|
12 | */ |
|
13 | protected $element = 'commit'; |
|
14 | ||
15 | /** |
|
16 | * @var bool |
|
17 | */ |
|
18 | protected $expungeDeletes; |
|
19 | ||
20 | /** |
|
21 | * @return string |
|
22 | */ |
|
23 | public function buildAttributes() |
|
24 | { |
|
25 | $attributes = parent::buildAttributes(); |
|
26 | $attributes .= $this->buildAttribute('expungeDeletes'); |
|
27 | return $attributes; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @param bool $expungeDeletes |
|
32 | * |
|
33 | * @return \PSolr\Request\Commit |
|
34 | * |
|
35 | * @see http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22commit.22 |
|
36 | */ |
|
37 | public function expungeDeletes($expungeDeletes = true) |
|
38 | { |
|
39 | $this->expungeDeletes = (bool) $expungeDeletes; |
|
40 | return $this; |
|
41 | } |
|
42 | } |
|
43 |
@@ 8-42 (lines=35) @@ | ||
5 | /** |
|
6 | * @see http://wiki.apache.org/solr/UpdateXmlMessages#A.22commit.22_and_.22optimize.22 |
|
7 | */ |
|
8 | class Optimize extends Update |
|
9 | { |
|
10 | /** |
|
11 | * @var string |
|
12 | */ |
|
13 | protected $element = 'optimize'; |
|
14 | ||
15 | /** |
|
16 | * @var int |
|
17 | */ |
|
18 | protected $maxSegments; |
|
19 | ||
20 | /** |
|
21 | * @return string |
|
22 | */ |
|
23 | public function buildAttributes() |
|
24 | { |
|
25 | $attributes = parent::buildAttributes(); |
|
26 | $attributes .= $this->buildAttribute('maxSegments'); |
|
27 | return $attributes; |
|
28 | } |
|
29 | ||
30 | /** |
|
31 | * @param int $maxSegments |
|
32 | * |
|
33 | * @return \PSolr\Request\Commit |
|
34 | * |
|
35 | * @see http://wiki.apache.org/solr/UpdateXmlMessages#Optional_attributes_for_.22optimize.22 |
|
36 | */ |
|
37 | public function setMaxSegments($maxSegments) |
|
38 | { |
|
39 | $this->maxSegments = (int) $maxSegments; |
|
40 | return $this; |
|
41 | } |
|
42 | } |
|
43 |