VuFind API Documentation

SearchService extends AbstractDbService
in package
implements SearchServiceInterface, DeleteExpiredInterface, DbTableAwareInterface Uses DbTableAwareTrait

Database service for search.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Interfaces, Classes, Traits and Enums

SearchServiceInterface
Database service interface for search.
DeleteExpiredInterface
Interface for exposing the "deleteExpired" method required by command line cleanup tools.
DbTableAwareInterface
Marker interface for classes that depend on the \VuFind\Db\Table\PluginManager

Table of Contents

$tableManager  : PluginManager
Database table plugin manager
cleanUpInvalidUserIds()  : int
Set invalid user_id values in the table to null; return count of affected rows.
createAndPersistEntityWithChecksum()  : SearchEntityInterface
Create a search entity containing the specified checksum, persist it to the database, and return a fully populated object. Throw an exception if something goes wrong during the process.
createEntity()  : SearchEntityInterface
Create a search entity.
deleteExpired()  : int
Delete expired records. Allows setting a limit so that rows can be deleted in small batches.
destroySession()  : void
Destroy unsaved searches belonging to the specified session/user.
getDbTable()  : Gateway
Get a database table object.
getDbTableManager()  : PluginManager
Get the table plugin manager. Throw an exception if it is missing.
getSavedSearchesWithMissingChecksums()  : array<string|int, SearchEntityInterface>
Get saved searches with missing checksums (used for cleaning up legacy data).
getScheduledSearches()  : array<string|int, SearchEntityInterface>
Get scheduled searches.
getSearchById()  : SearchEntityInterface|null
Get a SearchEntityInterface object by ID.
getSearchByIdAndOwner()  : SearchEntityInterface|null
Get a SearchEntityInterface object by ID and owner.
getSearches()  : array<string|int, SearchEntityInterface>
Get an array of rows for the specified user.
getSearchesByChecksumAndOwner()  : array<string|int, SearchEntityInterface>
Retrieve all searches matching the specified checksum and belonging to the user specified by session or user entity/ID.
persistEntity()  : void
Persist an entity.
setDbTableManager()  : void
Set the table plugin manager.

Properties

Methods

cleanUpInvalidUserIds()

Set invalid user_id values in the table to null; return count of affected rows.

public cleanUpInvalidUserIds() : int
Return values
int

createAndPersistEntityWithChecksum()

Create a search entity containing the specified checksum, persist it to the database, and return a fully populated object. Throw an exception if something goes wrong during the process.

public createAndPersistEntityWithChecksum(int $checksum) : SearchEntityInterface
Parameters
$checksum : int

Checksum

Tags
throws
Exception
Return values
SearchEntityInterface

deleteExpired()

Delete expired records. Allows setting a limit so that rows can be deleted in small batches.

public deleteExpired(DateTime $dateLimit[, int|null $limit = null ]) : int
Parameters
$dateLimit : DateTime

Date threshold of an "expired" record.

$limit : int|null = null

Maximum number of rows to delete or null for no limit.

Return values
int

Number of rows deleted

destroySession()

Destroy unsaved searches belonging to the specified session/user.

public destroySession(string $sessionId[, UserEntityInterface|int|null $userOrId = null ]) : void
Parameters
$sessionId : string

Session ID of current user.

$userOrId : UserEntityInterface|int|null = null

User entity or ID of current user (optional).

Return values
void

getDbTable()

Get a database table object.

public getDbTable(string $table) : Gateway
Parameters
$table : string

Table to load.

Return values
Gateway

getSearchesByChecksumAndOwner()

Retrieve all searches matching the specified checksum and belonging to the user specified by session or user entity/ID.

public getSearchesByChecksumAndOwner(int $checksum, string $sessionId[, UserEntityInterface|int|null $userOrId = null ]) : array<string|int, SearchEntityInterface>
Parameters
$checksum : int

Checksum to match

$sessionId : string

Current session ID

$userOrId : UserEntityInterface|int|null = null

Entity or ID representing current user (optional).

Tags
throws
Exception
Return values
array<string|int, SearchEntityInterface>

Search results