Skip to content

Commit c09a4f0

Browse files
fix: Add if statement to prevent error
Add an if statement to getSummonRangeFilter function so that it only processes Publication Date Filters. This this function trying to process and non-rnage filters that have already been added to the filterList array. These are structured differently and this causes an error.
1 parent d315027 commit c09a4f0

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

code/web/sys/SearchObject/SummonSearcher.php

+9-10
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ class SearchObject_SummonSearcher extends SearchObject_BaseSearcher{
101101
protected $rangeFacets = [
102102
'PublicationDate,1911:1920,1921:1930,1931:1940,1941:1950,1951:1960,1961:1970,1971:1980,1981:1990,1991:2000,2001:2010,2011:2020,2021:2030',
103103
];
104-
protected $rangeFilters = [
105-
];
104+
protected $rangeFilters = array();
106105

107106
protected $limitList = [];
108107
protected $limitFields;
@@ -281,7 +280,6 @@ public function getOptions () {
281280
//allows access to records
282281
's.role' => 'authenticated',
283282
);
284-
var_dump($options);
285283
return $options;
286284
}
287285

@@ -302,7 +300,6 @@ public function processData($recordData) {
302300
$this->rangeFacetFields = $recordData['rangeFacetFields'];
303301
$this->rangeFilters = $recordData['query']['rangeFilters'];
304302
}
305-
var_dump($recordData['query']['queryString']);
306303
return $recordData;
307304
}
308305

@@ -519,7 +516,6 @@ public function getFacetSet() {
519516
public function getRangeFacetSet() {
520517
$availableRangeFacets = [];
521518
$this->rangeFilters = [];
522-
523519
if (isset($this->rangeFacetFields)) {
524520
foreach ($this->rangeFacetFields as $rangeFacetField) {
525521
$facetId = $rangeFacetField['displayName'];
@@ -536,7 +532,7 @@ public function getRangeFacetSet() {
536532
foreach ($rangeFacetField['counts'] as $value) {
537533
$rangeFacetValue = $value['range'];
538534
$rangeValueString = $rangeFacetValue['minValue'] . '-' . $rangeFacetValue['maxValue'];
539-
$isApplied = array_key_exists($facetId, $this->rangeFilterList) && in_array($rangeValueString, $this->rangeFilterList[$facetId]);
535+
$isApplied = array_key_exists($facetId, $this->filterList) && in_array($rangeValueString, $this->filterList[$facetId]);
540536

541537
$rangeFacetSettings = [
542538
'value' => $rangeFacetValue['minValue'] . '-' . $rangeFacetValue['maxValue'],
@@ -615,9 +611,9 @@ public function getSummonFilters() {
615611
$this->filterList = array_merge($this->limitList, $this->filterList);
616612
}
617613
foreach ($this->filterList as $key => $value) {
618-
// if ($key === 'PublicationDate') {
619-
// continue;
620-
// }
614+
if ($key === 'PublicationDate') {
615+
continue;
616+
}
621617
if (is_array($value)) {
622618
foreach ($value as $val) {
623619
$encodedValue = urlencode($val);
@@ -632,9 +628,12 @@ public function getSummonFilters() {
632628
}
633629

634630
public function getSummonRangeFilters() {
635-
$this->rangeFilters = [];
631+
$this->rangeFilters = array();
636632
if (isset($this->filterList)) {
637633
foreach ($this->filterList as $key =>$value) {
634+
if ($key !== 'PublicationDate') {
635+
continue;
636+
}
638637
if (is_array($value)) {
639638
foreach ($value as $val) {
640639
$encodedValue = urlencode($val);

0 commit comments

Comments
 (0)