2008-08-06 05:28:25 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2008-08-09 08:40:50 +02:00
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Selects textual content with an exact match between columnname and keyword.
|
2008-08-06 05:28:25 +02:00
|
|
|
*
|
|
|
|
* @todo case sensitivity switch
|
|
|
|
* @todo documentation
|
|
|
|
*
|
|
|
|
* @package sapphire
|
|
|
|
* @subpackage search
|
|
|
|
*/
|
2008-08-09 05:54:55 +02:00
|
|
|
class ExactMatchFilter extends SearchFilter {
|
2008-08-06 05:28:25 +02:00
|
|
|
|
2008-08-09 06:06:52 +02:00
|
|
|
/**
|
|
|
|
* Applies an exact match (equals) on a field value.
|
|
|
|
*
|
|
|
|
* @return unknown
|
|
|
|
*/
|
2008-08-09 06:38:44 +02:00
|
|
|
public function apply(SQLQuery $query) {
|
2008-08-11 02:03:57 +02:00
|
|
|
$query = $this->applyRelation($query);
|
2008-10-05 21:20:35 +02:00
|
|
|
return $query->where(sprintf(
|
|
|
|
"%s = '%s'",
|
|
|
|
$this->getDbName(),
|
|
|
|
Convert::raw2sql($this->getValue())
|
|
|
|
));
|
2008-08-09 06:06:52 +02:00
|
|
|
}
|
|
|
|
|
2008-08-11 02:03:57 +02:00
|
|
|
public function isEmpty() {
|
|
|
|
return $this->getValue() == null || $this->getValue() == '';
|
|
|
|
}
|
2008-08-06 05:28:25 +02:00
|
|
|
}
|
|
|
|
?>
|