VuFind API Documentation

SwitchQuery
in package
implements RecommendInterface

SwitchQuery Recommendations Module

This class recommends adjusting your search query to yield better results.

Tags
category

VuFind

author

Demian Katz demian.katz@villanova.edu

author

Chris Hallberg challber@villanova.edu

license

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

link

Wiki

Interfaces, Classes, Traits and Enums

RecommendInterface
Search Recommendations Interface

Table of Contents

$backend  : string
Search backend identifier that we are working with.
$optInMethods  : array<string|int, mixed>
List of 'opt-in' methods (others are 'opt-out' by default).
$results  : Results
Search results object.
$searchService  : Service
Search service.
$skipChecks  : array<string|int, mixed>
Names of checks that should be skipped. These should correspond with check method names -- e.g. to skip the check found in the checkWildcard() method, you would put 'wildcard' into this array.
$suggestions  : array<string|int, mixed>
Improved query suggestions.
__construct()  : mixed
Constructor
getResults()  : Results
Get results stored in the object.
getSuggestions()  : array<string|int, mixed>
Get an array of suggestion messages.
init()  : void
Called before the Search Results object performs its main search (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).
process()  : void
Called after the Search Results object has performed its main search. This may be used to extract necessary information from the Search Results object or to perform completely unrelated processing.
setConfig()  : void
Store the configuration of the recommendation module.
checkFuzzy()  : string|bool
Will a fuzzy search help?
checkLowercaseBools()  : string|bool
Does the query contain lowercase boolean operators that should be uppercased?
checkTruncatechar()  : string|bool
Broaden search by truncating one character (e.g. call number)
checkUnwantedBools()  : string|bool
Does the query contain terms that are being treated as boolean operators, perhaps unintentionally?
checkUnwantedQuotes()  : string|bool
Would removing quotes help?
checkWildcard()  : string|bool
Will adding a wildcard help?
getLuceneHelper()  : bool|LuceneSyntaxHelper
Extract a Lucene syntax helper from the search backend, if possible.
queryShouldBeSkipped()  : bool
Should the query be ignored when making recommendations?

Properties

$backend

Search backend identifier that we are working with.

protected string $backend

$optInMethods

List of 'opt-in' methods (others are 'opt-out' by default).

protected array<string|int, mixed> $optInMethods = ['fuzzy', 'truncatechar']

$skipChecks

Names of checks that should be skipped. These should correspond with check method names -- e.g. to skip the check found in the checkWildcard() method, you would put 'wildcard' into this array.

protected array<string|int, mixed> $skipChecks = []

$suggestions

Improved query suggestions.

protected array<string|int, mixed> $suggestions = []

Methods

__construct()

Constructor

public __construct(Service $searchService) : mixed
Parameters
$searchService : Service

Search backend plugin manager

Return values
mixed

getSuggestions()

Get an array of suggestion messages.

public getSuggestions() : array<string|int, mixed>
Return values
array<string|int, mixed>

init()

Called before the Search Results object performs its main search (specifically, in response to \VuFind\Search\SearchRunner::EVENT_CONFIGURED).

public init(Params $params, Parameters $request) : void

This method is responsible for setting search parameters needed by the recommendation module and for reading any existing search parameters that may be needed.

Parameters
$params : Params

Search parameter object

$request : Parameters

Parameter object representing user request.

Return values
void

process()

Called after the Search Results object has performed its main search. This may be used to extract necessary information from the Search Results object or to perform completely unrelated processing.

public process(Results $results) : void
Parameters
$results : Results

Search results object

Return values
void

setConfig()

Store the configuration of the recommendation module.

public setConfig(string $settings) : void
Parameters
$settings : string

Settings from searches.ini.

Return values
void

checkFuzzy()

Will a fuzzy search help?

protected checkFuzzy(string $query) : string|bool
Parameters
$query : string

Query to check

Return values
string|bool

checkLowercaseBools()

Does the query contain lowercase boolean operators that should be uppercased?

protected checkLowercaseBools(string $query) : string|bool
Parameters
$query : string

Query to check

Return values
string|bool

checkTruncatechar()

Broaden search by truncating one character (e.g. call number)

protected checkTruncatechar(string $query) : string|bool
Parameters
$query : string

Query to transform

Return values
string|bool

checkUnwantedBools()

Does the query contain terms that are being treated as boolean operators, perhaps unintentionally?

protected checkUnwantedBools(string $query) : string|bool
Parameters
$query : string

Query to check

Return values
string|bool

checkUnwantedQuotes()

Would removing quotes help?

protected checkUnwantedQuotes(string $query) : string|bool
Parameters
$query : string

Query to check

Return values
string|bool

checkWildcard()

Will adding a wildcard help?

protected checkWildcard(string $query) : string|bool
Parameters
$query : string

Query to check

Return values
string|bool

queryShouldBeSkipped()

Should the query be ignored when making recommendations?

protected queryShouldBeSkipped(string $query) : bool
Parameters
$query : string

Query to check

Return values
bool

Search results