-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
floriansemm
committed
Nov 14, 2016
1 parent
174dd8a
commit 17acca4
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace FS\SolrBundle\Query; | ||
|
||
use FS\SolrBundle\Query\Exception\QueryException; | ||
|
||
class DeleteDocumentQuery extends AbstractQuery | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $documentKey; | ||
|
||
/** | ||
* @param string $documentKey | ||
*/ | ||
public function setDocumentKey($documentKey) | ||
{ | ||
$this->documentKey = $documentKey; | ||
} | ||
|
||
/** | ||
* @return string | ||
* | ||
* @throws QueryException when id or document_name is null | ||
*/ | ||
public function getQuery() | ||
{ | ||
$idField = $this->documentKey; | ||
|
||
if ($idField == null) { | ||
throw new QueryException('id should not be null'); | ||
} | ||
|
||
$this->setQuery(sprintf('id:%s', $idField)); | ||
|
||
return parent::getQuery(); | ||
} | ||
} |