RecordCollection
extends AbstractRecordCollection
in package
Simple JSON-based record collection.
Tags
Table of Contents
- $facetFields : array<string|int, mixed>
- Facet fields.
- $filteredFacetCounts : array<string|int, mixed>
- How many facet values have been filtered out, indexed by field.
- $offset : int
- Zero-based offset in complete search result.
- $pointer : int
- Array pointer
- $records : array<string|int, mixed>
- Response records.
- $response : array<string|int, mixed>
- Deserialized SOLR response.
- $source : string
- Source identifier
- $spellcheck : Spellcheck
- Spellcheck information.
- $template : array<string|int, mixed>
- Template of deserialized SOLR response.
- __construct() : void
- Constructor.
- add() : void
- Add a record to the collection.
- count() : int
- Return number of records in collection.
- current() : RecordInterface
- Return record at current collection index.
- first() : RecordInterface|null
- Return first record in response.
- getCursorMark() : string
- Get cursorMark.
- getErrors() : array<string|int, mixed>
- Return any errors.
- getFacets() : array<string|int, mixed>
- Return available facets.
- getFilteredFacetCounts() : array<string|int, mixed>
- Get filtered facet data.
- getGroups() : array<string|int, mixed>
- Get grouped results.
- getHighlighting() : array<string|int, mixed>
- Get highlighting details.
- getMaxScore() : mixed
- Gets the highest relevance to search.
- getOffset() : int
- Return offset in the total search result set.
- getPivotFacets() : array<string|int, mixed>
- Return available pivot facets.
- getQueryFacets() : array<string|int, mixed>
- Return available query facets.
- getRecords() : array<string|int, mixed>
- Return records.
- getResponseHeader() : array<string|int, mixed>
- Get response header.
- getSourceIdentifier() : string
- Return the source backend identifier.
- getSpellcheck() : Spellcheck
- Return spellcheck information.
- getTotal() : int
- Return total number of records found.
- has() : bool
- Check if the collection contains the given record
- key() : int
- Return current collection index.
- next() : void
- Move to next collection index.
- replace() : void
- Replace a record in the collection.
- rewind() : void
- Rewind collection index.
- setFacets() : void
- Set facets.
- setFilteredFacetCounts() : void
- Set filtered facet data.
- setSourceIdentifier() : void
- Set the source backend identifier.
- setSourceIdentifiers() : void
- Set the source backend identifiers.
- shuffle() : bool
- Shuffles records.
- slice() : void
- Slice the record list.
- valid() : bool
- Return true if current collection index is valid.
- getRawSpellcheckSuggestions() : array<string|int, mixed>
- Get raw Solr Spellcheck suggestions.
- getSolrParameters() : array<string|int, mixed>
- Get raw Solr input parameters from the response.
- getSpellcheckQuery() : string
- Extract the best matching Spellcheck query from the raw Solr input parameters.
Properties
$facetFields
Facet fields.
protected
array<string|int, mixed>
$facetFields
= null
$filteredFacetCounts
How many facet values have been filtered out, indexed by field.
protected
array<string|int, mixed>
$filteredFacetCounts
= []
$offset
Zero-based offset in complete search result.
protected
int
$offset
= 0
$pointer
Array pointer
protected
int
$pointer
= 0
$records
Response records.
protected
array<string|int, mixed>
$records
= []
$response
Deserialized SOLR response.
protected
array<string|int, mixed>
$response
$source
Source identifier
protected
string
$source
$spellcheck
Spellcheck information.
protected
Spellcheck
$spellcheck
$template
Template of deserialized SOLR response.
protected
static array<string|int, mixed>
$template
= ['responseHeader' => [], 'response' => ['numFound' => 0, 'start' => 0], 'spellcheck' => ['suggestions' => []], 'facet_counts' => []]
Tags
Methods
__construct()
Constructor.
public
__construct(array<string|int, mixed> $response) : void
Parameters
- $response : array<string|int, mixed>
-
Deserialized SOLR response
Return values
void —add()
Add a record to the collection.
public
add(RecordInterface $record[, bool $checkExisting = true ]) : void
Parameters
- $record : RecordInterface
-
Record to add
- $checkExisting : bool = true
-
Whether to check for existing record in the collection (slower, but makes sure there are no duplicates)
Return values
void —count()
Return number of records in collection.
public
count() : int
Return values
int —current()
Return record at current collection index.
public
current() : RecordInterface
Return values
RecordInterface —first()
Return first record in response.
public
first() : RecordInterface|null
Return values
RecordInterface|null —getCursorMark()
Get cursorMark.
public
getCursorMark() : string
Return values
string —getErrors()
Return any errors.
public
getErrors() : array<string|int, mixed>
Each error can be a translatable string or an array that the Flashmessages view helper understands.
Return values
array<string|int, mixed> —getFacets()
Return available facets.
public
getFacets() : array<string|int, mixed>
Returns an associative array with the field name as key. The value is an associative array of available facets for the field, indexed by facet value.
Return values
array<string|int, mixed> —getFilteredFacetCounts()
Get filtered facet data.
public
getFilteredFacetCounts() : array<string|int, mixed>
Return values
array<string|int, mixed> —getGroups()
Get grouped results.
public
getGroups() : array<string|int, mixed>
Return values
array<string|int, mixed> —getHighlighting()
Get highlighting details.
public
getHighlighting() : array<string|int, mixed>
Return values
array<string|int, mixed> —getMaxScore()
Gets the highest relevance to search.
public
getMaxScore() : mixed
Return values
mixed —getOffset()
Return offset in the total search result set.
public
getOffset() : int
Return values
int —getPivotFacets()
Return available pivot facets.
public
getPivotFacets() : array<string|int, mixed>
Returns an associative array with the internal field name as key. The value is an associative array of the available facets for the field, indexed by facet value.
Return values
array<string|int, mixed> —getQueryFacets()
Return available query facets.
public
getQueryFacets() : array<string|int, mixed>
Returns an associative array with the internal field name as key. The value is an associative array of the available facets for the field, indexed by facet value.
Return values
array<string|int, mixed> —getRecords()
Return records.
public
getRecords() : array<string|int, mixed>
Return values
array<string|int, mixed> —getResponseHeader()
Get response header.
public
getResponseHeader() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSourceIdentifier()
Return the source backend identifier.
public
getSourceIdentifier() : string
Return values
string —getSpellcheck()
Return spellcheck information.
public
getSpellcheck() : Spellcheck
Return values
Spellcheck —getTotal()
Return total number of records found.
public
getTotal() : int
Return values
int —has()
Check if the collection contains the given record
public
has(RecordInterface $record) : bool
Parameters
- $record : RecordInterface
-
Record to check
Return values
bool —key()
Return current collection index.
public
key() : int
Return values
int —next()
Move to next collection index.
public
next() : void
Return values
void —replace()
Replace a record in the collection.
public
replace(RecordInterface $record, RecordInterface $replacement) : void
Parameters
- $record : RecordInterface
-
Record to be replaced
- $replacement : RecordInterface
-
Replacement record
Return values
void —rewind()
Rewind collection index.
public
rewind() : void
Return values
void —setFacets()
Set facets.
public
setFacets(array<string|int, mixed> $facets) : void
Parameters
- $facets : array<string|int, mixed>
-
Facet fields
Return values
void —setFilteredFacetCounts()
Set filtered facet data.
public
setFilteredFacetCounts(array<string|int, mixed> $counts) : void
Parameters
- $counts : array<string|int, mixed>
-
Counts of filtered facet values, indexed by field name.
Return values
void —setSourceIdentifier()
Set the source backend identifier.
public
setSourceIdentifier(string $identifier) : void
Parameters
- $identifier : string
-
Backend identifier
Tags
Return values
void —setSourceIdentifiers()
Set the source backend identifiers.
public
setSourceIdentifiers(string $recordSourceId[, string $searchBackendId = '' ]) : void
Parameters
- $recordSourceId : string
-
Record source identifier
- $searchBackendId : string = ''
-
Search backend identifier (if different from $recordSourceId)
Return values
void —shuffle()
Shuffles records.
public
shuffle() : bool
Return values
bool —slice()
Slice the record list.
public
slice(int $offset, int $limit) : void
Parameters
- $offset : int
-
Offset
- $limit : int
-
Limit
Return values
void —valid()
Return true if current collection index is valid.
public
valid() : bool
Return values
bool —getRawSpellcheckSuggestions()
Get raw Solr Spellcheck suggestions.
protected
getRawSpellcheckSuggestions() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSolrParameters()
Get raw Solr input parameters from the response.
protected
getSolrParameters() : array<string|int, mixed>
Return values
array<string|int, mixed> —getSpellcheckQuery()
Extract the best matching Spellcheck query from the raw Solr input parameters.
protected
getSpellcheckQuery() : string