Maslosoft Manganel API
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
<?php
/**
* This software package is licensed under `AGPL, Commercial` license[s].
*
* @package maslosoft/manganel
* @license AGPL, Commercial
*
* @copyright Copyright (c) Peter Maselkowski <pmaselkowski@gmail.com>
* @link https://maslosoft.com/manganel/
*/
namespace Maslosoft\Manganel\Annotations;
use Maslosoft\Manganel\Meta\ManganelPropertyAnnotation;
/**
* Use this annotation to increase or decrease importance of field in search
* results. Use above one values to increase importance, and below one to
* decrease.
*
* Default value for query boosting is 1.0, using decimal values is perfectly
* fine. In fact it's required for demoting results.
*
* Increase importance example:
*
* ```php
* @SearchBoost(3)
* ```
*
* Decrease importance example:
*
```php
* @SearchBoost(0.3)
* ```
*
* @Target('property')
* @author Piotr Maselkowski <pmaselkowski at gmail.com>
*/
class SearchBoostAnnotation extends ManganelPropertyAnnotation
{
const Ns = __NAMESPACE__;
/**
* Search boosting value for a field
* @var float
*/
public $value = 1.0;
public function init()
{
assert(is_numeric($this->value), sprintf('@SearchBoost must be numeric value, on property: `%s::$%s`', $this->getMeta()->type()->name, $this->name));
$this->getEntity()->searchBoost = (float) $this->value;
}
}
API documentation generated by ApiGen