SolrPrefix
in package
implements
AutocompleteInterface
Solr autocomplete module with prefix queries using edge N-gram filter
This class provides suggestions by using the local Solr index.
Tags
Interfaces, Classes, Traits and Enums
- AutocompleteInterface
- Autocomplete Plug-In Interface
Table of Contents
- $autocompleteField : string
- Autocomplete field
- $facetField : string
- Facet field
- $filters : array<string|int, mixed>
- Filters to apply to Solr search
- $limit : int
- Facet limit, can be overridden in subclasses
- $resultsManager : PluginManager
- Results manager
- $searchClassId : string
- Search class id
- $searchObject : Results
- Search object
- __construct() : mixed
- Constructor
- addFilters() : void
- Add filters (in addition to the configured ones)
- getSuggestions() : array<string|int, mixed>
- Get suggestions
- setConfig() : void
- Set configuration
- initSearchObject() : void
- Initialize the search object used for finding recommendations.
- mungeQuery() : string
- Process the user query to make it suitable for a Solr query.
Properties
$autocompleteField
Autocomplete field
protected
string
$autocompleteField
$facetField
Facet field
protected
string
$facetField
$filters
Filters to apply to Solr search
protected
array<string|int, mixed>
$filters
= []
$limit
Facet limit, can be overridden in subclasses
protected
int
$limit
= 10
$resultsManager
Results manager
protected
PluginManager
$resultsManager
$searchClassId
Search class id
protected
string
$searchClassId
= 'Solr'
$searchObject
Search object
protected
Results
$searchObject
Methods
__construct()
Constructor
public
__construct(PluginManager $results) : mixed
Parameters
- $results : PluginManager
-
Results plugin manager
Return values
mixed —addFilters()
Add filters (in addition to the configured ones)
public
addFilters(array<string|int, mixed> $filters) : void
Parameters
- $filters : array<string|int, mixed>
-
Filters to add
Return values
void —getSuggestions()
Get suggestions
public
getSuggestions(string $query) : array<string|int, mixed>
This method returns an array of strings matching the user's query for display in the autocomplete box.
Parameters
- $query : string
-
The user query
Return values
array<string|int, mixed> —The suggestions for the provided query
setConfig()
Set configuration
public
setConfig(string $params) : void
Set parameters that affect the behavior of the autocomplete handler. These values normally come from the search configuration file.
Parameters
- $params : string
-
Parameters to set
Return values
void —initSearchObject()
Initialize the search object used for finding recommendations.
protected
initSearchObject() : void
Return values
void —mungeQuery()
Process the user query to make it suitable for a Solr query.
protected
mungeQuery(string $query) : string
Parameters
- $query : string
-
Incoming user query
Return values
string —Processed query