Recommendation modules are pluggable panels that appear alongside search results to help patrons refine their queries, discover related material, or correct search mistakes. Each module is an independent PHP class that reads the current search state, optionally issues additional queries, and renders a small template snippet. VuFind assembles these panels at three positions — the sidebar, the top of results, and the no-results area — based on configuration inDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vufind-org/vufind/llms.txt
Use this file to discover all available pages before exploring further.
searches.ini.
How recommendation modules work
When a search runs, VuFind’s search runner fires two lifecycle events that recommendation modules hook into:init()— Called before the main search. The module can read request parameters and modify the search parameters object to request extra data (for example, additional facets).process()— Called after the main search completes. The module can inspect the result set and prepare whatever data its template needs to render.
$recommend) and the current search results object ($results).
Configuring recommendations in searches.ini
The[General] section of searches.ini defines the default set of recommendation modules for all search types. You can also create search-type-specific overrides in [SideRecommendations], [TopRecommendations], and [NoResultsRecommendations].
setConfig() method. Repeat the key (with []) to load multiple modules in the same position.
Search-type overrides
To attach a module to a specific search type (such asAuthor) rather than all searches, add it to the relevant section:
false to suppress all recommendations for a particular search type:
Any search type not listed in the override sections falls back to the
default_top_recommend, default_side_recommend, and default_noresults_recommend values from [General].Built-in recommendation modules
SideFacets — faceted navigation sidebar
SideFacets — faceted navigation sidebar
SpellingSuggestions — did-you-mean
SpellingSuggestions — did-you-mean
Displays spelling corrections for the user’s query when Solr’s spellcheck component returns suggestions. Requires spelling to be enabled in No parameters are accepted. The module renders only when the search backend returns at least one spelling suggestion.
config.ini.AuthorInfo — Wikipedia author biography
AuthorInfo — Wikipedia author biography
RandomRecommend — random records
RandomRecommend — random records
Displays a set of randomly selected records, either from the entire backend or from within the current result set. Originally developed at Swansea University.Signature:
RandomRecommend:[backend]:[limit]:[display mode]:[random mode]:[minimumset]:[facet1]:[facetvalue1]...[backend]— Search backend identifier (default:Solr).[limit]— Number of records to display (default:10).[display mode]—standard,images, ormixed(default:standard).[random mode]—retainto draw from the current result set,disregardto draw from the full backend (default:retain).[minimumset]— Minimum result count before the panel appears (default:0).- Additional colon pairs apply facet filters to the random selection.
ExpandFacets — cross-search facet links
ExpandFacets — cross-search facet links
Displays facets that, when clicked, start a new search for all records matching that facet value rather than narrowing the current search. Useful for browsing by subject, format, or language.Signature:
ExpandFacets:[ini section]:[ini name][ini section]— Section in the facet ini file listing the fields to display.[ini name]— Facet ini file name (default:facets).
FacetCloud provides the same functionality with a more compact cloud-style display.SwitchQuery — query improvement suggestions
SwitchQuery — query improvement suggestions
Analyzes the patron’s query and suggests modifications that may yield better results — for example, removing quotes from a phrase search that returns zero hits. Shown in the no-results area.Signature:
SwitchQuery:[backend]:[opt-out checks]:[opt-in checks][backend]— Search backend (default:Solr).[opt-out checks]— Comma-separated list of default-on checks to disable.[opt-in checks]— Comma-separated list of off-by-default checks to enable, such asfuzzy.
Sidebar vs. top vs. no-results placement
| Position | Config key | Typical use |
|---|---|---|
| Sidebar | default_side_recommend[] / [SideRecommendations] | Facets, random records, external results |
| Top of results | default_top_recommend[] / [TopRecommendations] | Spelling, author info, facet clouds |
| No-results area | default_noresults_recommend[] / [NoResultsRecommendations] | Query fixes, filter removal, search-type switches |
Creating a custom recommendation module
Create the class
Create a PHP class in your local module that implements
VuFind\Recommend\RecommendInterface:Create the template
Add a template at
themes/<your-theme>/templates/Recommend/BestSellers.phtml. The template receives $recommend (your object) and $results (the search results):Register in module config
Add the module to the
recommend plugin manager in your local config/module.config.php: