Utils
in package
Solr Utility Functions
This class is designed to hold Solr-related support methods that may be called statically. This allows sharing of some Solr-related logic between the Solr and Summon classes.
Tags
Table of Contents
- parseRange() : array<string|int, mixed>|bool
- Parse "from" and "to" values out of a range query (or return false if the query is not a range).
- sanitizeDate() : string|null
- Convert a raw string date (as, for example, from a MARC record) into a legal Solr date string. Return null if conversion is impossible.
Methods
parseRange()
Parse "from" and "to" values out of a range query (or return false if the query is not a range).
public
static parseRange(string $query) : array<string|int, mixed>|bool
Parameters
- $query : string
-
Solr query to parse.
Return values
array<string|int, mixed>|bool —Array with 'from' and 'to' values extracted from range or false if the provided query is not a range.
sanitizeDate()
Convert a raw string date (as, for example, from a MARC record) into a legal Solr date string. Return null if conversion is impossible.
public
static sanitizeDate(string $date[, bool $rangeEnd = false ]) : string|null
Parameters
- $date : string
-
Date to convert.
- $rangeEnd : bool = false
-
Is this the end of a range?