-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from byng-systems/development_add_terms_query
Added support for terms queries
- Loading branch information
Showing
3 changed files
with
81 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
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,74 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the "byng/pimcore-elasticsearch-plugin" project. | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the LICENSE is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Byng\Pimcore\Elasticsearch\Query; | ||
|
||
/** | ||
* Terms Query | ||
* | ||
* Encapsulates a "terms" query's data. | ||
* | ||
* @author Asim Liaquat <[email protected]> | ||
*/ | ||
final class TermsQuery implements Query | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
private $field; | ||
|
||
/** | ||
* @var array | ||
*/ | ||
private $terms; | ||
|
||
/** | ||
* TermsQuery constructor. | ||
* | ||
* @param string $field | ||
* @param array $terms | ||
*/ | ||
public function __construct($field, array $terms) | ||
{ | ||
$this->field = $field; | ||
$this->terms = $terms; | ||
} | ||
|
||
/** | ||
* Get field | ||
* | ||
* @return string | ||
*/ | ||
public function getField() | ||
{ | ||
return $this->field; | ||
} | ||
|
||
/** | ||
* Get query | ||
* | ||
* @return array | ||
*/ | ||
public function getTerms() | ||
{ | ||
return $this->terms; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getType() | ||
{ | ||
return "terms"; | ||
} | ||
} |