PARSEPHRASE
in package
PARSEPHRASE -- break up a search phrase into component parts such as 'exact phrase', AND, OR and NOT
Table of Contents
Properties
- $attachmentSearch : mixed
- booolean
- $browserTabID : mixed
- string
- $db : mixed
- object
- $fulltext : mixed
- boolean *
- $NOTfragments : mixed
- array
- $stringArray : mixed
- array
- $useRegex : mixed
- array
Methods
- cleanupAndCheck() : mixed
- Perform various clean-up and validation routines on the input search phrase
- createCondition() : string
- Create the condition clause formatted for LIKE/REGEXP and store search highlighting in the session
- createConditionFT() : string
- Create the condition clause for FULL TEXT and store search highlighting in the session
- extractExactPhrase() : mixed
- extract all fragment elements until end of exact phrase is found
- filterWords() : mixed
- Remove any words to be filtered
- malformedString() : bool
- check for malformed search strings -- i.e. odd no. of " chars
- printFragments() : mixed
- Neatly print the elements of the quoteFragments array -- for debugging purposes only
- setHighlights() : mixed
- Store the search highlights
- sortFragments() : mixed
- loop through $fragments sorting into 'exact phrase', AND fragments, NOT fragments and OR fragments
- splitSpaces() : string
- split up search string on single spaces
- tidyFragment() : mixed
- For all AND, OR or NOT fragments, tidy the input so we have something usable
- tidySearch() : string
- Remove invalid instances of AND, OR or NOT at beginning or end of phrase
Properties
$attachmentSearch
booolean
private
mixed
$attachmentSearch
$browserTabID
string
private
mixed
$browserTabID
= \FALSE
$db
object
private
mixed
$db
$fulltext
boolean *
private
mixed
$fulltext
$NOTfragments
array
private
mixed
$NOTfragments
$stringArray
array
private
mixed
$stringArray
$useRegex
array
private
mixed
$useRegex
Methods
cleanupAndCheck()
Perform various clean-up and validation routines on the input search phrase
private
cleanupAndCheck(mixed $input) : mixed
Parameters
- $input : mixed
createCondition()
Create the condition clause formatted for LIKE/REGEXP and store search highlighting in the session
private
createCondition(array<string|int, mixed> $input, bool $test) : string
Parameters
- $input : array<string|int, mixed>
- $test : bool
-
If TRUE, we are just testing the parsing
Return values
stringcreateConditionFT()
Create the condition clause for FULL TEXT and store search highlighting in the session
private
createConditionFT(bool $partial) : string
Parameters
- $partial : bool
Return values
stringextractExactPhrase()
extract all fragment elements until end of exact phrase is found
private
extractExactPhrase(string $fragment, array<string|int, mixed> &$fragments, int $searchArrayIndex) : mixed
Parameters
- $fragment : string
- $fragments : array<string|int, mixed>
-
Reference to array
- $searchArrayIndex : int
filterWords()
Remove any words to be filtered
private
filterWords() : mixed
malformedString()
check for malformed search strings -- i.e. odd no. of " chars
private
malformedString(string $phrase) : bool
Parameters
- $phrase : string
Return values
boolprintFragments()
Neatly print the elements of the quoteFragments array -- for debugging purposes only
private
printFragments(array<string|int, mixed> $fragments) : mixed
Parameters
- $fragments : array<string|int, mixed>
setHighlights()
Store the search highlights
private
setHighlights(mixed $searchHighlight) : mixed
For multiple search terms, this is called repeatedly using xxx_Highlight to store intermediary terms
Parameters
- $searchHighlight : mixed
sortFragments()
loop through $fragments sorting into 'exact phrase', AND fragments, NOT fragments and OR fragments
private
sortFragments(array<string|int, mixed> $fragments) : mixed
Parameters
- $fragments : array<string|int, mixed>
splitSpaces()
split up search string on single spaces
private
splitSpaces(string $phrase) : string
Parameters
- $phrase : string
Return values
stringtidyFragment()
For all AND, OR or NOT fragments, tidy the input so we have something usable
private
tidyFragment(string $fragment, array<string|int, mixed> &$fragments, int $searchArrayIndex[, string $type = FALSE ]) : mixed
Parameters
- $fragment : string
- $fragments : array<string|int, mixed>
-
Reference to array
- $searchArrayIndex : int
- $type : string = FALSE
-
Default is FALSE
tidySearch()
Remove invalid instances of AND, OR or NOT at beginning or end of phrase
private
tidySearch(string $phrase) : string
Parameters
- $phrase : string