Data Model / Key Concepts
Most of VuFind®'s functionality is built around two important families of classes.
VuFind® is all about search, and a lot of the work of searching is similar no matter what data you are searching through. For this reason, VuFind® contains classes that deal with common search tasks: gathering user preferences (query, facets, etc.), dealing with paging, etc.
Every search performed by VuFind® involves three key classes:
- The search options class, which loads static options from configuration files. This determines what types of searches are legal.
- The search parameters class, which represents the settings for the current search – query, page size, facet list, etc. This class has routines for processing user input, or all parameters can be set individually by code. A search options object is used for validation.
- The search results class, which actually performs searches with the help of a search parameters object and turns them into an array of record drivers (described below).
Base classes are provided that implement common functionality for all three of these areas. To search different data sources (Solr index, WorldCat API, etc., etc.), subclasses with implementation-specific details for interacting with various low-level search services are provided.
While the search classes are used for retrieving sets of records based on search criteria, when retrieving one or more known records using their unique identifiers, a stand-alone \VuFind\Record\Loader class is used, which interfaces with the same search services as the search classes.
Regardless of where it comes from, every record in VuFind® is represented by a record driver object. Like the search objects, all record drivers inherit from a common base class that implements basic record-related behavior (saving to favorites, adding tags, etc.). However, subclasses have a great deal of flexibility in how they represent records. Each record driver gets its own set of templates for rendering within the VuFind® interface, so displays can be completely customized. However, by implementing a standard set of get methods for retrieving common sorts of data elements (title, author, subject, etc.) it is possible to share templates between similar record drivers for less complex code and a more consistent user experience.