boost() публичный Метод

Get boost for model.
public boost ( Model $model ) : integer
$model Illuminate\Database\Eloquent\Model
Результат integer
Пример #1
0
 public function testBoost()
 {
     $this->productMock->shouldReceive('getAttribute')->with('boost')->andReturn(0.5)->byDefault();
     $this->dummyMock->shouldReceive('getAttribute')->with('custom_boost_accessor')->andReturn(0.3)->byDefault();
     $actual = $this->config->boost($this->productMock);
     $this->assertEquals(0.5, $actual);
     $actual = $this->config->boost($this->dummyMock);
     $this->assertEquals(0.3, $actual);
 }
 /**
  * Update document in index for model
  *
  * @param Model $model
  */
 public function update(Model $model)
 {
     // Remove any existing documents for model.
     $this->delete($model);
     // Create new document for model.
     $doc = new Document();
     list($name, $value) = $this->config->primaryKeyPair($model);
     // Add private key.
     $doc->addField(Field::keyword($name, $value));
     // Add model's class UID.
     list($name, $value) = $this->config->classUidPair($model);
     // Add class uid for identification of model's class.
     $doc->addField(Field::Keyword($name, $value));
     // Get base fields.
     $fields = $this->config->fields($model);
     // Add fields to document to be indexed (but not stored).
     foreach ($fields as $fieldName => $options) {
         $fieldValue = $model->{trim($fieldName)};
         $field = Field::unStored(trim($fieldName), strip_tags(trim($fieldValue)));
         $field->boost = array_get($options, 'boost');
         $doc->addField($field);
     }
     // Get dynamic fields.
     $optionalAttributes = $this->config->optionalAttributes($model);
     // Add optional attributes to document to be indexed (but not stored).
     foreach ($optionalAttributes as $fieldName => $options) {
         $fieldValue = array_get($options, "value");
         $field = Field::unStored(trim($fieldName), strip_tags(trim($fieldValue)));
         $field->boost = array_get($options, "boost");
         $doc->addField($field);
     }
     // Set boost for model.
     $doc->boost = $this->config->boost($model);
     // Add document to index.
     $this->index()->addDocument($doc);
 }