Skip to content
Snippets Groups Projects
Commit 55c94f15 authored by Demian Katz's avatar Demian Katz
Browse files

Eliminated redundant/verbose code.

parent 4fc20551
No related merge requests found
...@@ -204,69 +204,7 @@ class SearchRequestModel ...@@ -204,69 +204,7 @@ class SearchRequestModel
*/ */
public function convertToQueryString() public function convertToQueryString()
{ {
$qs = ''; return http_build_query($this->convertToQueryStringParameterArray());
if (isset($this->query) && 0 < sizeof($this->query)) {
for ($x=0; $x<sizeof($this->query); $x++) {
$qs .= 'query-'.($x+1).'='.$this->query[$x].'&';
}
}
if (isset($this->facetFilters) && 0 < sizeof($this->facetFilters)) {
for ($x=0; $x<sizeof($this->facetFilters); $x++) {
$qs .= 'facetfilter='.$this->facetFilters[$x].'&';
}
}
if (isset($this->limiters) && 0 < sizeof($this->limiters)) {
for ($x=0; $x<sizeof($this->limiters); $x++) {
$qs .= 'limiter='.$this->limiters[$x].'&';
}
}
if (isset($this->expanders) && 0 < sizeof($this->expanders)) {
$expand = implode(",", $this->expanders);
$qs .= 'expander='.$expand.'&';
}
if (isset($this->includeFacets)) {
$qs .= 'includefacets='.$this->includeFacets.'&';
}
if (isset($this->sort)) {
$qs .= 'sort='.$this->sort.'&';;
}
if (isset($this->searchMode)) {
$qs .= 'searchmode='.$this->searchMode.'&';
}
if (isset($this->view)) {
$qs .= 'view='.$this->view.'&';
}
if (isset($this->resultsPerPage)) {
$qs .= 'resultsperpage='.$this->resultsPerPage.'&';
}
if (isset($this->pageNumber)) {
$qs .= 'pagenumber='.$this->pageNumber.'&';
}
if (isset($this->highlight)) {
$highlightVal = $this->highlight ? 'y' : 'n';
$qs .= 'highlight='.$highlightVal.'&';
}
if (isset($this->actions) && 0 < sizeof($this->actions)) {
for ($x=0; $x<sizeof($this->actions); $x++) {
$qs .= 'action-'.($x+1).'='.$this->actions[$x].'&';
}
}
if ($this->endsWith($qs, '&')) {
$qs = substr($qs, 0, -1);
}
return $qs;
} }
/** /**
...@@ -353,7 +291,7 @@ class SearchRequestModel ...@@ -353,7 +291,7 @@ class SearchRequestModel
public static function isParameterIndexed($value) public static function isParameterIndexed($value)
{ {
//Indexed parameter names end with '-x' //Indexed parameter names end with '-x'
return SearchRequestModel::endsWith($value, '-x'); return static::endsWith($value, '-x');
} }
/** /**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment