You are here

public function ApacheSolrDocument::setFieldBoost in Apache Solr Search 7

Same name and namespace in other branches
  1. 8 Apache_Solr_Document.php \ApacheSolrDocument::setFieldBoost()
  2. 6.3 Apache_Solr_Document.php \ApacheSolrDocument::setFieldBoost()

Set the field boost for a document field

Parameters

string $key: field name for the boost

mixed $boost: Use false for default boost, else cast to float that should be > 0 or will be treated as false

2 calls to ApacheSolrDocument::setFieldBoost()
ApacheSolrDocument::addField in ./Apache_Solr_Document.php
Add a value to a multi-valued field
ApacheSolrDocument::setField in ./Apache_Solr_Document.php
Set a field value. Multi-valued fields should be set as arrays or instead use the addField(...) function which will automatically make sure the field is an array.

File

./Apache_Solr_Document.php, line 245

Class

ApacheSolrDocument
Holds Key / Value pairs that represent a Solr Document along with any associated boost values. Field values can be accessed by direct dereferencing such as:

Code

public function setFieldBoost($key, $boost) {
  $boost = (double) $boost;
  if ($boost > 0.0) {
    $this->_fieldBoosts[$key] = $boost;
  }
  else {
    $this->_fieldBoosts[$key] = FALSE;
  }
}