final class SolrInputDocument (View source)

(PECL solr >= 0.9.2)
Class SolrInputDocument
This class represents a Solr document that is about to be submitted to the Solr index.

Constants

SORT_DEFAULT

SORT_ASC

SORT_DESC

SORT_FIELD_NAME

SORT_FIELD_VALUE_COUNT

SORT_FIELD_BOOST_VALUE

Methods

addChildDocument(SolrInputDocument $child)

(PECL solr >= 2.3.0)
Adds a child document for block indexing

addChildDocuments(array $docs)

(PECL solr >= 2.3.0)
Adds an array of child documents

bool
addField(string $fieldName, string $fieldValue, float $fieldBoostValue = 0.0)

(PECL solr >= 0.9.2)
Adds a field to the document

bool
clear()

(PECL solr >= 0.9.2)
Resets the input document

__clone()

(PECL solr >= 0.9.2)
Creates a copy of a SolrDocument

__construct()

(PECL solr >= 0.9.2)
SolrInputDocument constructor.

bool
deleteField(string $fieldName)

(PECL solr >= 0.9.2)
Removes a field from the document

__destruct()

(PECL solr >= 0.9.2)
Destructor

bool
fieldExists(string $fieldName)

(PECL solr >= 0.9.2)
Checks if a field exists

float|false
getBoost()

(PECL solr >= 0.9.2)
Retrieves the current boost value for the document

getChildDocuments()

(PECL solr >= 2.3.0)
Returns an array of child documents (SolrInputDocument)

int
getChildDocumentsCount()

(PECL solr >= 2.3.0)
Returns the number of child documents

getField(string $fieldName)

(PECL solr >= 0.9.2)
Retrieves a field by name

float|false
getFieldBoost(string $fieldName)

(PECL solr >= 0.9.2)
Retrieves the boost value for a particular field

int|false
getFieldCount()

(PECL solr >= 0.9.2)
Returns the number of fields in the document

array|false
getFieldNames()

(PECL solr >= 0.9.2)
Returns an array containing all the fields in the document

bool
hasChildDocuments()

(PECL solr >= 2.3.0)
Checks whether the document has any child documents

bool
merge(SolrInputDocument $sourceDoc, bool $overwrite = true)

(PECL solr >= 0.9.2)
Merges one input document into another

bool
reset()

(PECL solr >= 0.9.2)
This is an alias of SolrInputDocument::clear

bool
setBoost(float $documentBoostValue)

(PECL solr >= 0.9.2)
Sets the boost value for this document

setFieldBoost(string $fieldName, float $fieldBoostValue)

(PECL solr >= 0.9.2)
Sets the index-time boost value for a field https://php.net/manual/en/solrinputdocument.setfieldboost.php

bool
sort(int $sortOrderBy, int $sortDirection = SolrInputDocument::SORT_ASC)

(PECL solr >= 0.9.2)
Sorts the fields within the document

array|false
toArray()

(PECL solr >= 0.9.2)
Returns an array representation of the input document

Details

addChildDocument(SolrInputDocument $child)

(PECL solr >= 2.3.0)
Adds a child document for block indexing

Parameters

SolrInputDocument $child

A SolrInputDocument object.

Exceptions

SolrIllegalArgumentException
SolrException

addChildDocuments(array $docs)

(PECL solr >= 2.3.0)
Adds an array of child documents

Parameters

array $docs

An array of SolrInputDocument objects.

Exceptions

SolrIllegalArgumentException
SolrException

bool addField(string $fieldName, string $fieldValue, float $fieldBoostValue = 0.0)

(PECL solr >= 0.9.2)
Adds a field to the document

Parameters

string $fieldName

The name of the field

string $fieldValue

The value for the field.

float $fieldBoostValue

[optional]

The index time boost for the field. Though this cannot be negative, you can still pass values less than 1.0 but they must be greater than zero.

Return Value

bool

Returns TRUE on success or FALSE on failure.

bool clear()

(PECL solr >= 0.9.2)
Resets the input document

Return Value

bool

Returns TRUE on success or FALSE on failure.

__clone()

(PECL solr >= 0.9.2)
Creates a copy of a SolrDocument

__construct()

(PECL solr >= 0.9.2)
SolrInputDocument constructor.

bool deleteField(string $fieldName)

(PECL solr >= 0.9.2)
Removes a field from the document

Parameters

string $fieldName

The name of the field.

Return Value

bool

Returns TRUE on success or FALSE on failure.

__destruct()

(PECL solr >= 0.9.2)
Destructor

bool fieldExists(string $fieldName)

(PECL solr >= 0.9.2)
Checks if a field exists

Parameters

string $fieldName

Name of the field.

Return Value

bool

Returns TRUE if the field was found and FALSE if it was not found.

float|false getBoost()

(PECL solr >= 0.9.2)
Retrieves the current boost value for the document

Return Value

float|false

Returns the boost value on success and FALSE on failure.

SolrInputDocument[] getChildDocuments()

(PECL solr >= 2.3.0)
Returns an array of child documents (SolrInputDocument)

Return Value

SolrInputDocument[]

int getChildDocumentsCount()

(PECL solr >= 2.3.0)
Returns the number of child documents

Return Value

int

SolrDocumentField|false getField(string $fieldName)

(PECL solr >= 0.9.2)
Retrieves a field by name

Parameters

string $fieldName

The name of the field.

Return Value

SolrDocumentField|false

Returns a SolrDocumentField object on success and FALSE on failure.

float|false getFieldBoost(string $fieldName)

(PECL solr >= 0.9.2)
Retrieves the boost value for a particular field

Parameters

string $fieldName

The name of the field.

Return Value

float|false

Returns the boost value for the field or FALSE if there was an error.

int|false getFieldCount()

(PECL solr >= 0.9.2)
Returns the number of fields in the document

Return Value

int|false

Returns an integer on success or FALSE on failure.

array|false getFieldNames()

(PECL solr >= 0.9.2)
Returns an array containing all the fields in the document

Return Value

array|false

Returns an array on success and FALSE on failure.

bool hasChildDocuments()

(PECL solr >= 2.3.0)
Checks whether the document has any child documents

Return Value

bool

Returns TRUE if the document has any child documents

bool merge(SolrInputDocument $sourceDoc, bool $overwrite = true)

(PECL solr >= 0.9.2)
Merges one input document into another

Parameters

SolrInputDocument $sourceDoc

The source document.

bool $overwrite

[optional]

If this is TRUE it will replace matching fields in the destination document.

Return Value

bool

Returns TRUE on success or FALSE on failure. In the future, this will be modified to return the number of fields in the new document.

bool reset()

(PECL solr >= 0.9.2)
This is an alias of SolrInputDocument::clear

Return Value

bool

Returns TRUE on success or FALSE on failure.

bool setBoost(float $documentBoostValue)

(PECL solr >= 0.9.2)
Sets the boost value for this document

Parameters

float $documentBoostValue

The index-time boost value for this document.

Return Value

bool

Returns TRUE on success or FALSE on failure.

setFieldBoost(string $fieldName, float $fieldBoostValue)

(PECL solr >= 0.9.2)
Sets the index-time boost value for a field https://php.net/manual/en/solrinputdocument.setfieldboost.php

Parameters

string $fieldName

The name of the field.

float $fieldBoostValue

The index time boost value.

bool sort(int $sortOrderBy, int $sortDirection = SolrInputDocument::SORT_ASC)

(PECL solr >= 0.9.2)
Sorts the fields within the document

Parameters

int $sortOrderBy

The sort criteria, must be one of :

  • SolrInputDocument::SORT_FIELD_NAME
  • SolrInputDocument::SORT_FIELD_BOOST_VALUE
  • SolrInputDocument::SORT_FIELD_VALUE_COUNT

int $sortDirection

[optional]

The sort direction, can be one of :

  • SolrInputDocument::SORT_DEFAULT
  • SolrInputDocument::SORT_ASC
  • SolrInputDocument::SORT_DESC

Return Value

bool

Returns TRUE on success or FALSE on failure.

array|false toArray()

(PECL solr >= 0.9.2)
Returns an array representation of the input document

Return Value

array|false

Returns an array containing the fields. It returns FALSE on failure.