VuFind API Documentation

QueryBuilderTest extends TestCase
in package

Unit tests for SOLR query builder

Tags
category

VuFind

author

David Maus maus@hab.de

license

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

link
https://vufind.org

Table of Contents

globalExtraParamsGroupedQueryDataProvider()  : array<string|int, mixed>
Data provider for testGroupedQueryHandlerWithGlobalExtraParams().
globalExtraParamsIndividualQueryDataProvider()  : array<string|int, mixed>
Data provider for testIndividualQueryHandlerWithGlobalExtraParams().
testExactQueryHandler()  : void
Test that the appropriate handler gets called for a quoted search when exact settings are enabled.
testGroupedQueryHandlerWithGlobalExtraParams()  : void
Test generation with GlobalExtraParams using a grouped query.
testHlQ()  : void
Test hl.q edge case: when we are in dismax (not edismax) mode, and a boost is set, and a query contains advanced syntax, VuFind manipulates the query to trigger the boost and sets hl.q to prevent the highlighter from matching the wrong words.
testIndividualQueryHandlerWithGlobalExtraParams()  : void
Test generation with GlobalExtraParams using individual queries.
testMatchAllQueryWithFilterQueryAndNoDisMax()  : void
Test generation with a query handler with a filter set and no DisMax settings when the query is "all records"
testMixedQuotedPhrases()  : void
Test generation with mix of quoted and unquoted phrases
testMixedQuotedPhrasesWithEscapedQuote()  : void
Test generation with mix of quoted and unquoted phrases
testMultipleQuotedPhrases()  : void
Test generation with multiple quoted phrases.
testNegatedAndQuery()  : void
Test a negated clause of an AND query.
testNegatedOrQuery()  : void
Test a negated clause of an OR query.
testNegatedQuery()  : void
Test a fully negated query.
testNormalization()  : void
Test normalization of unusual queries.
testQueryGroup()  : void
Test generation from a QueryGroup
testQueryGroupWithAdvancedSyntax()  : void
Test generation from a QueryGroup with advanced syntax
testQueryHandler()  : void
Test generation with a query handler
testQueryHandlerWithDismax()  : void
Test generation with a query handler with regular dismax
testQueryHandlerWithEdismax()  : void
Test generation with a query handler with edismax
testQueryHandlerWithFilterQueryAndDisMax()  : void
Test generation with a query handler with a filter set and DisMax settings
testQueryHandlerWithFilterQueryAndNoDisMax()  : void
Test generation with a query handler with a filter set and no DisMax settings
testSetCreateSpellingQuery()  : void
Test generation with spelling, using the setCreateSpellingQuery() method.
testSetFieldsToHighlight()  : void
Test generation with highlighting, using the setFieldsToHighlight() method.
getQuestionTests()  : array<string|int, mixed>
Return array of [test query, expected result] arrays.
runAdvancedQuestionTest()  : void
Run a test case through an advanced query.
runBasicQuestionTest()  : void
Run a test case through a basic query.
runQuestionTests()  : void
Run the standard suite of question mark tests, accounting for differences between stanard Lucene, basic Dismax and eDismax handlers.

Methods

globalExtraParamsGroupedQueryDataProvider()

Data provider for testGroupedQueryHandlerWithGlobalExtraParams().

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

globalExtraParamsIndividualQueryDataProvider()

Data provider for testIndividualQueryHandlerWithGlobalExtraParams().

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

testExactQueryHandler()

Test that the appropriate handler gets called for a quoted search when exact settings are enabled.

public testExactQueryHandler() : void
Return values
void

testGroupedQueryHandlerWithGlobalExtraParams()

Test generation with GlobalExtraParams using a grouped query.

public testGroupedQueryHandlerWithGlobalExtraParams(array<string|int, mixed> $globalExtraParams, array<string|int, mixed> $expectedFields) : void
Parameters
$globalExtraParams : array<string|int, mixed>

Global extra parameters

$expectedFields : array<string|int, mixed>

Expected fields

Tags
dataProvider

globalExtraParamsGroupedQueryDataProvider

Return values
void

testHlQ()

Test hl.q edge case: when we are in dismax (not edismax) mode, and a boost is set, and a query contains advanced syntax, VuFind manipulates the query to trigger the boost and sets hl.q to prevent the highlighter from matching the wrong words.

public testHlQ() : void
Return values
void

testIndividualQueryHandlerWithGlobalExtraParams()

Test generation with GlobalExtraParams using individual queries.

public testIndividualQueryHandlerWithGlobalExtraParams(array<string|int, mixed> $globalExtraParams, array<string|int, mixed> $expected1, array<string|int, mixed> $expected2) : void
Parameters
$globalExtraParams : array<string|int, mixed>

Global extra parameters

$expected1 : array<string|int, mixed>

First set of expected fields

$expected2 : array<string|int, mixed>

Second set of expected fields

Tags
dataProvider

globalExtraParamsIndividualQueryDataProvider

Return values
void

testMatchAllQueryWithFilterQueryAndNoDisMax()

Test generation with a query handler with a filter set and no DisMax settings when the query is "all records"

public testMatchAllQueryWithFilterQueryAndNoDisMax() : void
Return values
void

testMixedQuotedPhrases()

Test generation with mix of quoted and unquoted phrases

public testMixedQuotedPhrases() : void
Return values
void

testMixedQuotedPhrasesWithEscapedQuote()

Test generation with mix of quoted and unquoted phrases

public testMixedQuotedPhrasesWithEscapedQuote() : void
Return values
void

testMultipleQuotedPhrases()

Test generation with multiple quoted phrases.

public testMultipleQuotedPhrases() : void
Return values
void

testNegatedAndQuery()

Test a negated clause of an AND query.

public testNegatedAndQuery() : void
Return values
void

testNegatedOrQuery()

Test a negated clause of an OR query.

public testNegatedOrQuery() : void
Return values
void

testNegatedQuery()

Test a fully negated query.

public testNegatedQuery() : void
Return values
void

testNormalization()

Test normalization of unusual queries.

public testNormalization() : void
Return values
void

testQueryGroup()

Test generation from a QueryGroup

public testQueryGroup() : void
Return values
void

testQueryGroupWithAdvancedSyntax()

Test generation from a QueryGroup with advanced syntax

public testQueryGroupWithAdvancedSyntax() : void
Return values
void

testQueryHandler()

Test generation with a query handler

public testQueryHandler() : void
Return values
void

testQueryHandlerWithDismax()

Test generation with a query handler with regular dismax

public testQueryHandlerWithDismax() : void
Return values
void

testQueryHandlerWithEdismax()

Test generation with a query handler with edismax

public testQueryHandlerWithEdismax() : void
Return values
void

testQueryHandlerWithFilterQueryAndDisMax()

Test generation with a query handler with a filter set and DisMax settings

public testQueryHandlerWithFilterQueryAndDisMax() : void
Return values
void

testQueryHandlerWithFilterQueryAndNoDisMax()

Test generation with a query handler with a filter set and no DisMax settings

public testQueryHandlerWithFilterQueryAndNoDisMax() : void
Return values
void

testSetCreateSpellingQuery()

Test generation with spelling, using the setCreateSpellingQuery() method.

public testSetCreateSpellingQuery() : void
Return values
void

testSetFieldsToHighlight()

Test generation with highlighting, using the setFieldsToHighlight() method.

public testSetFieldsToHighlight() : void
Return values
void

getQuestionTests()

Return array of [test query, expected result] arrays.

protected getQuestionTests() : array<string|int, mixed>
Return values
array<string|int, mixed>

runAdvancedQuestionTest()

Run a test case through an advanced query.

protected runAdvancedQuestionTest(QueryBuilder $qb, string $handler, array<string|int, mixed> $test) : void
Parameters
$qb : QueryBuilder

Query builder

$handler : string

Search handler: dismax|edismax|standard

$test : array<string|int, mixed>

Test to run

Return values
void

runBasicQuestionTest()

Run a test case through a basic query.

protected runBasicQuestionTest(QueryBuilder $qb, string $handler, array<string|int, mixed> $test) : void
Parameters
$qb : QueryBuilder

Query builder

$handler : string

Search handler: dismax|edismax|standard

$test : array<string|int, mixed>

Test to run

Return values
void

runQuestionTests()

Run the standard suite of question mark tests, accounting for differences between stanard Lucene, basic Dismax and eDismax handlers.

protected runQuestionTests(array<string|int, mixed> $builderParams, string $handler) : void
Parameters
$builderParams : array<string|int, mixed>

Parameters for QueryBuilder constructor

$handler : string

Search handler: dismax|edismax|standard

Return values
void

Search results