3 # FILE: SearchParameterSet.php 5 # Part of the ScoutLib application support library 6 # Copyright 2015-2016 Edward Almasy and Internet Scout Research Group 7 # http://scout.wisc.edu 16 # ---- SETUP / CONFIGURATION --------------------------------------------- 28 # if set data supplied 31 # set internal values from data 32 $this->LoadFromData($Data);
42 foreach ($this->Subgroups as &$Group)
44 $Group = clone $Group;
57 if (is_callable($Func))
59 self::$CanonicalFieldFunction = $Func;
63 throw new InvalidArgumentException(
"Invalid function supplied.");
76 if (is_callable($Func))
78 self::$PrintableFieldFunction = $Func;
82 throw new InvalidArgumentException(
"Invalid function supplied.");
92 # ---- SET CONSTRUCTION --------------------------------------------------- 107 # normalize field value if supplied 108 $Field = self::NormalizeField($Field);
110 # make sure search strings are an array 111 if (!is_array($SearchStrings))
112 { $SearchStrings = array($SearchStrings); }
114 # for each search string 115 foreach ($SearchStrings as $String)
120 # add strings to search values for field 121 $this->SearchStrings[$Field][] = $String;
125 # add strings to keyword search values 126 $this->KeywordSearchStrings[] = $String;
141 # normalize field value if supplied 142 $Field = self::NormalizeField($Field);
144 # if search strings specified 145 if ($SearchStrings != NULL)
147 # make sure search strings are an array 148 if (!is_array($SearchStrings))
149 { $SearchStrings = array($SearchStrings); }
151 # for each search string 152 foreach ($SearchStrings as $String)
157 # if there are search parameters for this field 158 if (isset($this->SearchStrings[$Field]))
160 # remove any matching search parameters 161 $NewSearchStrings = array();
162 foreach ($this->SearchStrings[$Field] as $Value)
164 if ($Value != $String)
166 $NewSearchStrings[] = $Value;
169 if (count($NewSearchStrings))
171 $this->SearchStrings[$Field] = $NewSearchStrings;
175 unset($this->SearchStrings[$Field]);
181 # remove any matching keyword search parameters 182 $NewSearchStrings = array();
183 foreach ($this->KeywordSearchStrings as $Value)
185 if ($Value != $String)
187 $NewSearchStrings[] = $Value;
190 $this->KeywordSearchStrings = $NewSearchStrings;
199 # clear any search strings for this field 200 if (isset($this->SearchStrings[$Field]))
202 unset($this->SearchStrings[$Field]);
207 # clear all keyword search parameters 208 $this->KeywordSearchStrings = array();
212 # for each parameter subgroup 213 $NewSubgroups = array();
214 foreach ($this->Subgroups as $Group)
216 # remove parameter from subgroup 217 $Group->RemoveParameter($SearchStrings, $Field);
219 # if the subgroup is not empty 220 if ($Group->ParameterCount())
223 $NewSubgroups[] = $Group;
226 $this->Subgroups = $NewSubgroups;
236 public function Logic($NewValue = NULL)
238 # if new value supplied 239 if ($NewValue !== NULL)
246 : strtoupper($NewValue));
248 # error out if value appears invalid 249 if (($NormValue !==
"AND") && ($NormValue !==
"OR"))
251 throw new InvalidArgumentException(
"New logic setting" 252 .
" is invalid (".$NewValue.
").");
256 $this->
Logic = $NormValue;
259 # return current logic setting to caller 273 if ($ItemTypes !== NULL)
275 if ($ItemTypes === FALSE)
281 if (!is_array($ItemTypes))
283 $ItemTypes = array($ItemTypes);
288 return $this->ItemTypes;
302 if ($NewValue !== NULL)
304 $this->
SortBy = $NewValue;
306 return $this->SortBy;
322 if ($NewValue !== NULL)
326 return $this->SortDescending;
337 $this->Subgroups[] = $Set;
343 # ---- DATA RETRIEVAL ----------------------------------------------------- 352 $Count = count($this->KeywordSearchStrings);
353 foreach ($this->SearchStrings as $Field => $Strings)
355 $Count += count($Strings);
357 foreach ($this->Subgroups as $Group)
359 $Count += $Group->ParameterCount();
373 $SearchStrings = $this->SearchStrings;
374 if ($IncludeSubgroups)
376 foreach ($this->Subgroups as $Group)
378 $SubStrings = $Group->GetSearchStrings(TRUE);
379 foreach ($SubStrings as $Field => $Strings)
381 if (isset($SearchStrings[$Field]))
383 $SearchStrings[$Field] = array_merge(
384 $SearchStrings[$Field], $Strings);
388 $SearchStrings[$Field] = $Strings;
393 return $SearchStrings;
406 # normalize field value 407 $Field = self::NormalizeField($Field);
409 # start with our string values 410 $Strings = isset($this->SearchStrings[$Field])
411 ? $this->SearchStrings[$Field] : array();
413 # if strings from subgroups should also be returned 414 if ($IncludeSubgroups)
417 foreach ($this->Subgroups as $Group)
419 # add any strings from that subgroup 420 $Strings = array_merge($Strings,
421 $Group->GetSearchStringsForField($Field));
425 # return all strings found to caller 435 return $this->KeywordSearchStrings;
444 return $this->Subgroups;
453 # retrieve our fields 454 $Fields = array_keys($this->SearchStrings);
457 foreach ($this->Subgroups as $Group)
459 # add fields from subgroup to the list 460 $Fields = array_merge($Fields, $Group->GetFields());
463 # filter out duplicates and sort to ensure consistency 464 $Fields = array_unique($Fields);
467 # return list of field identifiers to caller 473 # ---- DATA TRANSLATION --------------------------------------------------- 486 public function Data($NewValue = NULL)
488 # if new data supplied 489 if ($NewValue !== NULL)
491 # unpack set data and load 492 $this->LoadFromData($NewValue);
495 # serialize current data and return to caller 497 if ($this->
Logic !==
"AND") { $Data[
"Logic"] = $this->Logic; }
498 if (count($this->SearchStrings))
499 { $Data[
"SearchStrings"] = $this->SearchStrings; }
500 if (count($this->KeywordSearchStrings))
502 $Data[
"KeywordSearchStrings"] = $this->KeywordSearchStrings;
504 if (count($this->Subgroups))
506 foreach ($this->Subgroups as $Subgroup)
508 $Data[
"Subgroups"][] = $Subgroup->Data();
511 return serialize($Data);
522 # if new value supplied 523 if ($NewValue !== NULL)
526 $this->SetFromUrlParameters($NewValue);
529 # get existing search parameters as URL parameters 530 $Params = $this->GetAsUrlParameters();
532 # sort parameters by parameter name to normalize result 535 # return parameters to caller 550 # combine values into string 553 foreach ($Params as $Index => $Value)
555 $ParamString .= $Separator.$Index.
"=".urlencode($Value);
559 # return string to caller 575 $TruncateLongWordsTo = 0, $Indent =
"")
577 # define list of phrases used to represent logical operators 578 $OperatorPhrases = array(
581 ">" =>
"is greater than",
582 "<" =>
"is less than",
583 ">=" =>
"is at least",
584 "<=" =>
"is no more than",
587 "^" =>
"begins with",
589 "@" =>
"was last modified on or after",
590 "@>" =>
"was last modified after",
591 "@>=" =>
"was last modified on or after",
592 "@<" =>
"was last modified before",
593 "@<=" =>
"was last modified on or before",
595 $AgoOperatorPhrases = array(
596 "@>" =>
"was last modified more than",
597 "@>=" =>
"was last modified at least or more than",
598 "@<" =>
"was last modified less than",
599 "@<=" =>
"was last modified at most or less than",
602 # set characters used to indicate literal strings 603 $LiteralStart = $IncludeHtml ?
"<i>" :
"\"";
604 $LiteralEnd = $IncludeHtml ?
"</i>" :
"\"";
605 $LiteralBreak = $IncludeHtml ?
"<br>\n" :
"\n";
606 $Indent .= $IncludeHtml ?
" " :
" ";
608 # for each keyword search string 609 $Descriptions = array();
610 foreach ($this->KeywordSearchStrings as $SearchString)
612 # escape search string if appropriate 615 $SearchString = defaulthtmlentities($SearchString);
618 # add string to list of descriptions 619 $Descriptions[] = $LiteralStart.$SearchString.$LiteralEnd;
622 # for each field with search strings 623 foreach ($this->SearchStrings as $FieldId => $SearchStrings)
625 # retrieve field name 626 $FieldName = call_user_func(self::$PrintableFieldFunction, $FieldId);
628 # for each search string 629 foreach ($SearchStrings as $SearchString)
631 # extract operator from search string 632 $MatchResult = preg_match(
'/^([=><!^$@]+)(.+)/',
633 $SearchString, $Matches);
635 # determine operator phrase 636 if (($MatchResult == 1) && isset($OperatorPhrases[$Matches[1]]))
638 if (isset($AgoOperatorPhrases[$Matches[1]])
639 && strstr($SearchString,
"ago"))
641 $OpPhrase = $AgoOperatorPhrases[$Matches[1]];
645 $OpPhrase = $OperatorPhrases[$Matches[1]];
647 $SearchString = $Matches[2];
651 $OpPhrase =
"contains";
654 # escape field name and search string if appropriate 657 $FieldName = defaulthtmlentities($FieldName);
658 $SearchString = defaulthtmlentities($SearchString);
661 # assemble field and operator and value into description 662 $Descriptions[] = $FieldName.
" ".$OpPhrase.
" " 663 .$LiteralStart.$SearchString.$LiteralEnd;
668 foreach ($this->Subgroups as $Subgroup)
670 # retrieve description for subgroup 671 if ($Subgroup->ParameterCount() == 1)
673 $Descriptions[] = $Subgroup->TextDescription($IncludeHtml,
674 $StartWithBreak, $TruncateLongWordsTo, $Indent);
676 elseif ($Subgroup->ParameterCount() > 1)
678 $Descriptions[] =
"(".$Subgroup->TextDescription($IncludeHtml,
679 $StartWithBreak, $TruncateLongWordsTo, $Indent).
")";
683 # join descriptions with appropriate conjunction 684 $Descrip = join($LiteralBreak.$Indent.
" ".strtolower($this->
Logic).
" ",
687 # if caller requested that long words be truncated 688 if ($TruncateLongWordsTo > 4)
690 # break description into words 691 $Words = explode(
" ", $Descrip);
695 foreach ($Words as $Word)
697 # if word is longer than specified length 698 if (strlen(strip_tags($Word)) > $TruncateLongWordsTo)
700 # truncate word and add ellipsis 704 # add word to new description 705 $NewDescrip .=
" ".$Word;
708 # set description to new description 709 $Descrip = $NewDescrip;
712 if (isset(self::$TextDescriptionFilterFunction))
714 $Descrip = call_user_func_array(
715 self::$TextDescriptionFilterFunction,
719 # return description to caller 720 return trim($Descrip);
725 # ---- UTILITY METHODS ---------------------------------------------------- 735 # modify our fielded search strings 736 foreach ($this->SearchStrings as $Field => $Strings)
738 $this->SearchStrings[$Field] =
739 preg_replace($Pattern, $Replacement, $Strings);
742 # modify our keyword search strings 743 if (count($this->KeywordSearchStrings))
745 $this->KeywordSearchStrings =
746 preg_replace($Pattern, $Replacement, $this->KeywordSearchStrings);
749 # modify any subgroups 750 foreach ($this->Subgroups as $Group)
752 $Group->ReplaceSearchString($Pattern, $Replacement);
758 # ---- BACKWARD COMPATIBILITY --------------------------------------------- 773 $Group = $this->ConvertToLegacyGroup();
776 $Legacy[
"MAIN"] = $Group;
780 foreach ($this->Subgroups as $Subgroup)
782 # skip empty search groups 783 if (count($Subgroup->SearchStrings)==0)
788 $SubLegacy = $Subgroup->ConvertToLegacyGroup();
790 # give an index based on the FieldId of the first 791 # element in the SearchStrings 792 $FieldId = call_user_func(
793 self::$CanonicalFieldFunction,
794 current(array_keys($SubLegacy[
"SearchStrings"])) );
796 # add groups from legacy array to our array 797 if (!isset($Legacy[$FieldId]))
799 $Legacy[$FieldId] = $SubLegacy;
803 $Num = count($Legacy[$FieldId]);
804 $Legacy[$FieldId.
"-".$Num] = $SubLegacy;
807 if (count($Subgroup->Subgroups))
810 "Attempt to convert SearchParameterSet containing nested subgroups " 811 .
"to legacy format");
815 # return array to caller 825 # clear current settings 826 $this->KeywordSearchStrings = array();
827 $this->SearchStrings = array();
828 $this->Subgroups = array();
830 # iterate over legacy search groups 831 foreach ($SearchGroups as $GroupId => $SearchGroup)
833 if ($GroupId ==
"MAIN")
835 # add terms from the main search group to ourself 836 $this->LoadFromLegacyGroup($SearchGroup);
840 # create subgroups for other groups 842 $Subgroup->LoadFromLegacyGroup($SearchGroup);
844 # add any non-empty groups 845 if ($Subgroup->ParameterCount())
859 # clear current settings 860 $this->KeywordSearchStrings = array();
861 $this->SearchStrings = array();
862 $this->Subgroups = array();
864 # extact array of parameters from passed string 865 $GetVars = ParseQueryString($ParameterString);
867 # iterate over the provided parameters 868 foreach ($GetVars as $Key => $Val)
870 # if this param gives search information 871 if (preg_match(
"/^([FGH])(K|[0-9]+)$/", $Key, $Matches))
873 # extract what kind of search it was which field 875 $FieldId = $Matches[2];
877 # for 'contains' searches 880 # add this to our search strings 882 ($FieldId ==
"K" ? NULL : $FieldId) );
886 # otherwise, create a subgroup for this parameter 889 # set logic based on the search type 890 $Subgroup->Logic($Type==
"H" ?
"AND" :
"OR");
892 # extract the values and add them to a subgroup 893 $Values = explode(
"-", $Val);
894 $Subgroup->AddParameter(
895 self::TranslateLegacySearchValues($FieldId, $Values),
898 # if subgroup was non-empty, slurp it up 899 if ($Subgroup->ParameterCount())
915 $QueryVars = ParseQueryString($ParameterString);
917 return (array_key_exists(
"Q", $QueryVars) &&
918 $QueryVars[
"Q"] ==
"Y") ? TRUE : FALSE ;
929 $SearchParams->SetFromLegacyUrl($ParameterString);
931 return $SearchParams->UrlParameterString();
942 if (is_callable($Func))
944 self::$LegacyUrlTranslationFunction = $Func;
948 throw new InvalidArgumentException(
"Invalid function supplied.");
961 if (is_callable($Func))
963 self::$TextDescriptionFilterFunction = $Func;
967 throw new InvalidArgumentException(
"Invalid function supplied.");
979 if (($Field !== NULL) && isset(self::$LegacyUrlTranslationFunction))
981 $Values = call_user_func(self::$LegacyUrlTranslationFunction,
988 # ---- PRIVATE INTERFACE ------------------------------------------------- 990 private $KeywordSearchStrings = array();
991 private $ItemTypes = FALSE;
992 private $Logic = self::DEFAULT_LOGIC;
993 private $SearchStrings = array();
994 private $SortBy = FALSE;
995 private $SortDescending = TRUE;
996 private $Subgroups = array();
998 static private $CanonicalFieldFunction;
999 static private $PrintableFieldFunction;
1000 static private $LegacyUrlTranslationFunction;
1001 static private $TextDescriptionFilterFunction;
1002 static private $UrlParameterPrefix =
"F";
1014 private function LoadFromData($Serialized)
1017 $Data = unserialize($Serialized);
1018 if (!is_array($Data))
1020 throw new InvalidArgumentException(
"Incoming set data" 1021 .
" appears invalid.");
1025 $this->
Logic = isset($Data[
"Logic"]) ? $Data[
"Logic"] :
"AND";
1027 # load search strings 1028 $this->SearchStrings = isset($Data[
"SearchStrings"])
1029 ? $Data[
"SearchStrings"] : array();
1030 $this->KeywordSearchStrings = isset($Data[
"KeywordSearchStrings"])
1031 ? $Data[
"KeywordSearchStrings"] : array();
1033 # load any subgroups 1034 $this->Subgroups = array();
1035 if (isset($Data[
"Subgroups"]))
1037 foreach ($Data[
"Subgroups"] as $SubgroupData)
1048 private function ConvertToLegacyGroup()
1051 # for each set of search strings 1052 foreach ($this->SearchStrings as $Field => $Strings)
1054 # get text name of field 1055 $FieldName = call_user_func(self::$PrintableFieldFunction, $Field);
1058 $Group[
"SearchStrings"][$FieldName] = $Strings;
1061 # for each keyword search string 1062 foreach ($this->KeywordSearchStrings as $String)
1064 # add string to keyword entry in group 1065 $Group[
"SearchStrings"][
"XXXKeywordXXX"][] = $String;
1068 # if we had any search terms 1071 # smash single-value arrays to a scalar 1072 foreach ($Group[
"SearchStrings"] as &$Tgt)
1074 if (count($Tgt) == 1)
1076 $Tgt = current($Tgt);
1080 # set logic for search group 1081 $Group[
"Logic"] = ($this->
Logic ==
"OR")
1092 private function LoadFromLegacyGroup($Group)
1094 # set logic appropriately 1099 # if this group had no search strings, we're done 1100 if (!isset($Group[
"SearchStrings"]))
1105 # otherwise, load the search strings 1106 foreach ($Group[
"SearchStrings"] as $Field => $Params)
1109 if (count($Params)==0)
1115 ($Field ==
"XXXKeywordXXX" ? NULL : $Field) );
1125 private function GetAsUrlParameters($SetPrefix =
"")
1127 # for each search string group in set 1129 foreach ($this->SearchStrings as $FieldId => $Values)
1131 # get numeric version of field ID if not already numeric 1132 if (!is_numeric($FieldId))
1134 $FieldId = call_user_func(self::$CanonicalFieldFunction, $FieldId);
1137 # for each search string in group 1139 foreach ($Values as $Value)
1141 # check for too many search strings for this field 1142 if ($ParamSuffix ==
"Z")
1144 throw new Exception(
"Maximum search parameter complexity" 1145 .
" exceeded: more than 26 search parameters for" 1146 .
" field ID ".$FieldId.
".");
1149 # add search string to URL 1150 $Params[self::$UrlParameterPrefix.$SetPrefix
1151 .$FieldId.$ParamSuffix] = $Value;
1152 $ParamSuffix = ($ParamSuffix ==
"") ?
"A" 1153 : chr(ord($ParamSuffix) + 1);
1157 # for each keyword search string 1159 foreach ($this->KeywordSearchStrings as $Value)
1161 # check for too many keyword search strings 1162 if ($ParamSuffix ==
"Z")
1164 throw new Exception(
"Maximum search parameter complexity" 1165 .
" exceeded: more than 26 keyword search parameters.");
1168 # add search string to URL 1169 $Params[self::$UrlParameterPrefix.$SetPrefix
1170 .self::URL_KEYWORD_INDICATOR.$ParamSuffix] = $Value;
1171 $ParamSuffix = ($ParamSuffix ==
"") ?
"A" 1172 : chr(ord($ParamSuffix) + 1);
1175 # add logic if not default 1176 if ($this->
Logic != self::DEFAULT_LOGIC)
1178 $Params[self::$UrlParameterPrefix.$SetPrefix
1179 .self::URL_LOGIC_INDICATOR] = $this->Logic;
1182 # for each search parameter subgroup 1184 foreach ($this->Subgroups as $Subgroup)
1186 # check for too many subgroups 1187 if ($SetLetter ==
"Z")
1189 throw new Exception(
"Maximum search parameter complexity" 1190 .
" exceeded: more than 24 search parameter subgroups.");
1193 # retrieve URL string for subgroup and add it to URL 1194 $Params = array_merge($Params, $Subgroup->GetAsUrlParameters(
1195 $SetPrefix.$SetLetter));
1197 # move to next set letter 1198 $SetLetter = ($SetLetter == chr(ord(self::URL_KEYWORD_INDICATOR) - 1))
1199 ? chr(ord(self::URL_KEYWORD_INDICATOR) + 1)
1200 : chr(ord($SetLetter) + 1);
1203 # return constructed URL parameter string to caller 1213 private function SetFromUrlParameters($UrlParameters)
1215 # if string was passed in 1216 if (is_string($UrlParameters))
1218 # split string into parameter array 1219 $Params = explode(
"&", $UrlParameters);
1221 # pare down parameter array to search parameter elements 1222 # and strip off search parameter prefix 1223 $NewUrlParameters = array();
1224 foreach ($Params as $Param)
1226 if (strpos($Param, self::$UrlParameterPrefix) === 0)
1228 list($Index, $Value) = explode(
"=", $Param);
1229 $NewUrlParameters[$Index] = urldecode($Value);
1232 $UrlParameters = $NewUrlParameters;
1235 # for each search parameter 1236 foreach ($UrlParameters as $ParamName => $SearchString)
1238 # strip off standard search parameter prefix 1239 $ParamName = substr($ParamName, strlen(self::$UrlParameterPrefix));
1241 # split parameter into component parts 1242 $SplitResult = preg_match(
"/^([".self::URL_KEYWORDFREE_RANGE.
"]*)" 1243 .
"([0-9".self::URL_KEYWORD_INDICATOR.
"]+)([A-Z]*)$/",
1244 $ParamName, $Matches);
1246 # if split was successful 1247 if ($SplitResult === 1)
1249 # pull components from split pieces 1250 $SetPrefix = $Matches[1];
1251 $FieldId = $Matches[2];
1252 $ParamSuffix = $Matches[3];
1254 # if set prefix indicates parameter is part of our set 1255 if ($SetPrefix ==
"")
1259 case self::URL_LOGIC_INDICATOR:
1261 $this->
Logic($SearchString);
1264 case self::URL_KEYWORD_INDICATOR:
1265 # add string to keyword searches 1266 $this->KeywordSearchStrings[] = $SearchString;
1270 # add string to searches for appropriate field 1271 $this->SearchStrings[$FieldId][] = $SearchString;
1277 # add parameter to array for subgroup 1278 $SubgroupIndex = $SetPrefix[0];
1279 $SubgroupPrefix = (strlen($SetPrefix) > 1)
1280 ? substr($SetPrefix, 1) :
"";
1281 $SubgroupParamIndex = self::$UrlParameterPrefix
1282 .$SubgroupPrefix.$FieldId.$ParamSuffix;
1283 $SubgroupParameters[$SubgroupIndex][$SubgroupParamIndex]
1289 # if subgroups were found 1290 if (isset($SubgroupParameters))
1292 # for each identified subgroup 1293 foreach ($SubgroupParameters as $SubgroupIndex => $Parameters)
1295 # create subgroup and set parameters 1297 $Subgroup->SetFromUrlParameters($Parameters);
1299 # add subgroup to our set 1300 $this->Subgroups[] = $Subgroup;
1310 private static function NormalizeField($Field)
1312 if (($Field !== NULL) && isset(self::$CanonicalFieldFunction))
1314 $Field = call_user_func(self::$CanonicalFieldFunction, $Field);
TextDescription($IncludeHtml=TRUE, $StartWithBreak=TRUE, $TruncateLongWordsTo=0, $Indent="")
Get text description of search parameter set.
Data($NewValue=NULL)
Get/set search parameter set data, in the form of an opaque string.
static TranslateLegacySearchValues($Field, $Values)
Translate legacy search values to modern equivalents if possible.
SetFromLegacyArray($SearchGroups)
Set search parameters from legacy array format.
static SetCanonicalFieldFunction($Func)
Register function used to retrieve a canonical value for a field.
Set of parameters used to perform a search.
AddSet(SearchParameterSet $Set)
Add subgroup of search parameters to set.
UrlParameterString($NewValue=NULL)
Get/set search parameter set, in the form of an URL parameter string.
UrlParameters($NewValue=NULL)
Get/set search parameter set, in the form of URL parameters.
const URL_KEYWORD_INDICATOR
const URL_KEYWORDFREE_RANGE
Logic($NewValue=NULL)
Get/set logic for set.
GetFields()
Get fields used in search parameters (including subgroups).
static SetLegacyUrlTranslationFunction($Func)
Register function used to converrt values from the format used in a Legacy URL string to the modern v...
ItemTypes($ItemTypes=NULL)
Get/set allowed item types.
GetSearchStringsForField($Field, $IncludeSubgroups=TRUE)
Get search strings for specified field.
static SetPrintableFieldFunction($Func)
Register function used to retrieve a printable value for a field.
SetFromLegacyUrl($ParameterString)
Set search parameters from legacy URL string.
__clone()
Class clone handler, implemented so that clones will be deep copies rather than PHP5's default shallo...
AddParameter($SearchStrings, $Field=NULL)
Add search parameter to set.
static ConvertLegacyUrl($ParameterString)
Convert legacy URL to the current URL format.
GetAsLegacyArray()
Retrieve search parameters in legacy array format.
GetSearchStrings($IncludeSubgroups=FALSE)
Get search strings in set.
static NeatlyTruncateString($String, $MaxLength, $BreakAnywhere=FALSE)
Attempt to truncate a string as neatly as possible with respect to word breaks, punctuation, and HTML tags.
__construct($Data=NULL)
Class constructor, used to create a new set or reload an existing set from previously-constructed dat...
RemoveParameter($SearchStrings, $Field=NULL)
Remove search parameter from set.
static IsLegacyUrl($ParameterString)
Determine if a URL uses legacy format.
GetKeywordSearchStrings()
Get keyword search strings in set.
ReplaceSearchString($Pattern, $Replacement)
Modify all search strings with the specified regular expression.
SortBy($NewValue=NULL)
Get/set field to sort results by.
SortDescending($NewValue=NULL)
Get/set whether to sort results will be sorted in descending (as opposed to ascending) order...
const URL_LOGIC_INDICATOR
GetSubgroups()
Get parameter subgroups.
ParameterCount()
Get number of search parameters in set, including those in subgroups.
static SetTextDescriptionFilterFunction($Func)
Register function used to filter text descriptions of searches prior to display.