SEARCHCOMMON
in package
Common functions used by QSEARCH and ASEARCH but also by, for example, INSERTCITATION and the soundExplorer plugin
The gateway is getIds(). Thus, the function of this class is to return resource ids that match the words in a complex search phrase.
If the search is from neither ASEARCH, QSEARCH, nor INSERTCITATION, then $fields and $phrase must be populated. $unions can be added to with further SELECT statements.
If the search is advanced search, arrays such as $this->parsePhrase->ands are multidimensionsal. Otherwise, they are single dimension arrays.
Table of Contents
Properties
- $cte : mixed
- array
- $db : mixed
- object
- $metadata : mixed
- object
- $notExceptsFound : mixed
- bool
- $parsePhrase : mixed
- object
- $stmt : mixed
- object
- $ua : mixed
- object
Methods
- abstractUnion() : string
- Create union for the abstract field
- addedByIdUnion() : void
- Create union for the addedBy field ids
- addToCte() : void
- For advsearch, add Select and Comparison SQL statements to CTE array
- aFieldSql() : string
- create the unions for advanced search using various types of field other than Word
- attachmentUnion() : string
- Create union for searching attachments
- categoryIdUnion() : void
- Create union for the category field ids
- checkNonExcepts() : void
- Check the entire asearch input for any Button1 which is AND or OR.
- checkWordFirst() : void
- Check if a word search is the first field. If not set active flags to TRUE so that the first word field's Button1 is not treated as an AND
- collectionIdUnion() : void
- Create union for the collection field ids
- createComparisonCondition() : mixed
- Format comparisons for SQL conditions
- creatorIdUnion() : void
- Create union for the creator field ids
- creatorUnion() : string
- Create union for the creator field
- customLUnion() : string
- Create union for the customL field
- customSUnion() : string
- Create union for the customS field
- editedByIdUnion() : void
- Create union for the publication year field
- keywordIdUnion() : void
- Create union for the resource keyword field ids
- keywordUnion() : string
- Create union for the keyword field
- languageUnion() : string
- Create union for the language field
- maturityIndexUnion() : void
- Create union for the maturity index field ids
- metadataUnion() : string
- Create union for the metadata field
- metaKeywordIdUnion() : void
- Create union for the metadata keyword field ids
- noteUnion() : string
- Create union for the note field
- parseInput() : mixed
- parse the search input
- publicationYearUnion() : void
- Create union for the publication year field ids
- publisherIdUnion() : void
- Create union for the publisher field ids
- qFieldSql() : string
- create the unions for quick search
- resetAsearchArrays() : void
- Reset the arrays in asearch word parsing
- subcategoryIdUnion() : void
- Create union for the subcategory field ids
- tagIdUnion() : void
- Create union for the import tag field ids
- titleUnion() : string
- Create union for the title field
- typeUnion() : void
- Create union for the resource type field ids
- useBibQs() : string
- Select statement for a user bibliography if browsing one during insert citation
- userTagIdUnion() : void
- Create union for the userTag field ids
- userTagUnion() : string
- Create union for the userTag field
Properties
$cte
array
private
mixed
$cte
= []
$db
object
private
mixed
$db
$metadata
object
private
mixed
$metadata
$notExceptsFound
bool
private
mixed
$notExceptsFound
= \FALSE
$parsePhrase
object
private
mixed
$parsePhrase
$stmt
object
private
mixed
$stmt
$ua
object
private
mixed
$ua
Methods
abstractUnion()
Create union for the abstract field
private
abstractUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringaddedByIdUnion()
Create union for the addedBy field ids
private
addedByIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
addToCte()
For advsearch, add Select and Comparison SQL statements to CTE array
private
addToCte(array<string|int, mixed> $input, string $sql[, bool $not = FALSE ]) : void
Parameters
- $input : array<string|int, mixed>
- $sql : string
- $not : bool = FALSE
-
= FALSE
aFieldSql()
create the unions for advanced search using various types of field other than Word
private
aFieldSql(string $field[, string $search = '' ][, string $searchFT = '' ][, bool $apos = FALSE ][, array<string|int, mixed> $input = [] ]) : string
Parameters
- $field : string
- $search : string = ''
-
= ''
- $searchFT : string = ''
-
= ''
- $apos : bool = FALSE
-
= FALSE
- $input : array<string|int, mixed> = []
-
= []
Return values
stringattachmentUnion()
Create union for searching attachments
private
attachmentUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringcategoryIdUnion()
Create union for the category field ids
private
categoryIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
checkNonExcepts()
Check the entire asearch input for any Button1 which is AND or OR.
private
checkNonExcepts() : void
When compiling non-word cte statements, we cannot have a final cte array which only has EXCEPT statements. If there are no AND or OR Button1s, we must convert any potential EXCEPT cte to INTERSECT with negative condition.
Note that comparison fields have no NOT value for Button1
checkWordFirst()
Check if a word search is the first field. If not set active flags to TRUE so that the first word field's Button1 is not treated as an AND
private
checkWordFirst() : void
collectionIdUnion()
Create union for the collection field ids
private
collectionIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
createComparisonCondition()
Format comparisons for SQL conditions
private
createComparisonCondition(string $field, string $key, mixed $Value1[, mixed $Value2 = '' ]) : mixed
Parameters
- $field : string
- $key : string
- $Value1 : mixed
- $Value2 : mixed = ''
-
= ''
creatorIdUnion()
Create union for the creator field ids
private
creatorIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
creatorUnion()
Create union for the creator field
private
creatorUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringcustomLUnion()
Create union for the customL field
private
customLUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringcustomSUnion()
Create union for the customS field
private
customSUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringeditedByIdUnion()
Create union for the publication year field
private
editedByIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
keywordIdUnion()
Create union for the resource keyword field ids
private
keywordIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
keywordUnion()
Create union for the keyword field
private
keywordUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringlanguageUnion()
Create union for the language field
private
languageUnion(array<string|int, mixed> $input) : string
Parameters
- $input : array<string|int, mixed>
Return values
stringmaturityIndexUnion()
Create union for the maturity index field ids
private
maturityIndexUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
metadataUnion()
Create union for the metadata field
private
metadataUnion(string $search[, bool $apos = FALSE ][, string $type = '' ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
- $type : string = ''
-
Optional 'q', 'p', 'm'
Return values
stringmetaKeywordIdUnion()
Create union for the metadata keyword field ids
private
metaKeywordIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
noteUnion()
Create union for the note field
private
noteUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringparseInput()
parse the search input
private
parseInput() : mixed
publicationYearUnion()
Create union for the publication year field ids
private
publicationYearUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
publisherIdUnion()
Create union for the publisher field ids
private
publisherIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
qFieldSql()
create the unions for quick search
private
qFieldSql(string $search, string $searchFT[, bool $apos = FALSE ]) : string
$this->qsearchFields is the default set of fields to search for QUICKSEARCH and INSERTCITATION. Other functions, such as the soundexplorer plugin, can overwrite this public array.
Parameters
- $search : string
- $searchFT : string
- $apos : bool = FALSE
-
= FALSE
Return values
stringresetAsearchArrays()
Reset the arrays in asearch word parsing
private
resetAsearchArrays() : void
subcategoryIdUnion()
Create union for the subcategory field ids
private
subcategoryIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
tagIdUnion()
Create union for the import tag field ids
private
tagIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
titleUnion()
Create union for the title field
private
titleUnion(string $search[, bool $apos = FALSE ][, bool $withSubtitle = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE
- $withSubtitle : bool = FALSE
-
= FALSE
Return values
stringtypeUnion()
Create union for the resource type field ids
private
typeUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
useBibQs()
Select statement for a user bibliography if browsing one during insert citation
private
useBibQs() : string
Return values
stringuserTagIdUnion()
Create union for the userTag field ids
private
userTagIdUnion(array<string|int, mixed> $input) : void
Parameters
- $input : array<string|int, mixed>
userTagUnion()
Create union for the userTag field
private
userTagUnion(string $search[, bool $apos = FALSE ]) : string
Parameters
- $search : string
- $apos : bool = FALSE
-
= FALSE