VuFind API Documentation

SearchHandler
in package

VuFind SearchHandler.

The SearchHandler implements the rule-based translation of a user search query to a SOLR query string.

Tags
category

VuFind

author

Andrew S. Nagy vufind-tech@lists.sourceforge.net

author

David Maus maus@hab.de

author

Demian Katz demian.katz@villanova.edu

license

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

link
https://vufind.org

Table of Contents

$booleanOperators  : array<string|int, mixed>
Known boolean operators.
$configKeys  : array<string|int, mixed>
Known configuration keys.
$specs  : array<string|int, mixed>
Search handler specification.
__construct()  : void
Constructor.
createAdvancedQueryString()  : string
Return an advanced query string.
createBoostQueryString()  : string
Return an advanced query string for specified search string.
createSimpleQueryString()  : string
Return a simple query string.
getAllFields()  : array<string|int, mixed>
Get a list of all Solr fields searched by this handler.
getDismaxFields()  : array<string|int, mixed>
Return defined dismax fields.
getDismaxHandler()  : string
Get the name of the Dismax handler to be used with this search.
getDismaxParams()  : array<string|int, mixed>
Return defined dismax parameters.
getFilterQuery()  : string
Return the filter query.
hasDismax()  : bool
Return true if the handler defines Dismax fields.
hasExtendedDismax()  : bool
Return true if the handler supports Extended Dismax.
hasFilterQuery()  : bool
Return true if handler defines a filter query.
preprocessQueryString()  : string
Apply standard pre-processing to the query string.
toArray()  : array<string|int, mixed>
Serialize handler specs as array.
createQueryString()  : string
Return query string for specified search string.
customMunge()  : string
Apply a munge operation to a search string.
dismaxMunge()  : string
Apply custom search string munging to a Dismax query.
dismaxSubquery()  : string
Return a Dismax subquery for specified search string.
munge()  : string
Return modified search string after applying the transformation rules.
mungeRules()  : array<string|int, mixed>
Return array of munge rules.
mungeValues()  : string
Return the munge values for specified search string.
setDefaultMustMatch()  : void
Support method for constructor: if no mm is provided, set a reasonable default based on the selected Dismax handler.
tokenize()  : array<string|int, mixed>
Tokenize the search string.

Properties

$booleanOperators

Known boolean operators.

protected static array<string|int, mixed> $booleanOperators = ['AND', 'OR', 'NOT']

$configKeys

Known configuration keys.

protected static array<string|int, mixed> $configKeys = ['CustomMunge', 'DismaxFields', 'DismaxHandler', 'QueryFields', 'DismaxParams', 'FilterQuery', 'DismaxMunge']

$specs

Search handler specification.

protected array<string|int, mixed> $specs

Methods

__construct()

Constructor.

public __construct(array<string|int, mixed> $spec[, string $defaultDismaxHandler = 'dismax' ]) : void
Parameters
$spec : array<string|int, mixed>

Search handler specification

$defaultDismaxHandler : string = 'dismax'

Default dismax handler (if no DismaxHandler set in specs).

Return values
void

createAdvancedQueryString()

Return an advanced query string.

public createAdvancedQueryString(string $search) : string

An advanced query string is a query string based on a search string w/ lucene syntax features.

Parameters
$search : string

Search string

Tags
see
LuceneSyntaxHelper::containsAdvancedLuceneSyntax()
Return values
string

createBoostQueryString()

Return an advanced query string for specified search string.

public createBoostQueryString(string $search) : string
Parameters
$search : string

Search string

Return values
string

createSimpleQueryString()

Return a simple query string.

public createSimpleQueryString(string $search) : string
Parameters
$search : string

Search string

Tags
see
SearchHandler::createAdvancedQueryString()
Return values
string

getAllFields()

Get a list of all Solr fields searched by this handler.

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

getDismaxFields()

Return defined dismax fields.

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

getDismaxHandler()

Get the name of the Dismax handler to be used with this search.

public getDismaxHandler() : string
Return values
string

getDismaxParams()

Return defined dismax parameters.

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

getFilterQuery()

Return the filter query.

public getFilterQuery() : string
Return values
string

hasDismax()

Return true if the handler defines Dismax fields.

public hasDismax() : bool
Return values
bool

hasExtendedDismax()

Return true if the handler supports Extended Dismax.

public hasExtendedDismax() : bool
Return values
bool

hasFilterQuery()

Return true if handler defines a filter query.

public hasFilterQuery() : bool
Return values
bool

preprocessQueryString()

Apply standard pre-processing to the query string.

public preprocessQueryString(string $search) : string
Parameters
$search : string

Search string

Return values
string

toArray()

Serialize handler specs as array.

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

createQueryString()

Return query string for specified search string.

protected createQueryString(string $search[, bool $advanced = false ]) : string

If optional argument $advanced is true the search string contains advanced lucene query syntax.

Parameters
$search : string

Search string

$advanced : bool = false

Is the search an advanced search string?

Return values
string

customMunge()

Apply a munge operation to a search string.

protected customMunge(string $string, array<string|int, mixed> $operation) : string
Parameters
$string : string

string to munge

$operation : array<string|int, mixed>

munge operation

Return values
string

dismaxMunge()

Apply custom search string munging to a Dismax query.

protected dismaxMunge(string $search) : string
Parameters
$search : string

searchstring

Return values
string

dismaxSubquery()

Return a Dismax subquery for specified search string.

protected dismaxSubquery(string $search) : string
Parameters
$search : string

Search string

Return values
string

munge()

Return modified search string after applying the transformation rules.

protected munge(array<string|int, mixed> $mungeRules, array<string|int, mixed> $mungeValues[, string $joiner = 'OR' ]) : string
Parameters
$mungeRules : array<string|int, mixed>

Munge rules

$mungeValues : array<string|int, mixed>

Munge values

$joiner : string = 'OR'

Joiner of subqueries

Return values
string

mungeRules()

Return array of munge rules.

protected mungeRules() : array<string|int, mixed>
Tags
todo

Maybe rename?

Return values
array<string|int, mixed>

mungeValues()

Return the munge values for specified search string.

protected mungeValues(string $search[, bool $tokenize = true ]) : string

If optional argument $tokenize is true tokenize the search string.

Parameters
$search : string

Search string

$tokenize : bool = true

Tokenize the search string?

Return values
string

setDefaultMustMatch()

Support method for constructor: if no mm is provided, set a reasonable default based on the selected Dismax handler.

protected setDefaultMustMatch() : void
Return values
void

tokenize()

Tokenize the search string.

protected tokenize(string $string) : array<string|int, mixed>
Parameters
$string : string

Search string

Return values
array<string|int, mixed>

Search results