Skip to content

Commit bec1c31

Browse files
committed
Fixed: search map now uses Solarium
Updates #381
1 parent 2811352 commit bec1c31

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

crm/blocks/html/tickets/searchResultsMap.inc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
/**
33
* Displays a map of the search results
44
*
5-
* @copyright 2013-2020 City of Bloomington, Indiana
5+
* @copyright 2013-2021 City of Bloomington, Indiana
66
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE
7-
* @param Apache_Solr_Response $this->solrObject
7+
* @param \Solarium\QueryType\Select\Result\Result $this->result
88
*/
99
use Blossom\Classes\Block;
1010
use Blossom\Classes\Url;
1111

1212
$this->_include('tickets/partials/searchResultsFormatButtons.inc');
13-
$c = $this->solrObject->response->numFound;
13+
$c = $this->result->getNumFound();
1414
?>
1515
<section class="searchResults">
1616
<header>
@@ -38,18 +38,18 @@ $c = $this->solrObject->response->numFound;
3838
}
3939
$zoom = isset($_GET['zoom']) ? (int)$_GET['zoom'] : 12;
4040

41-
$solr_params = isset($this->solrObject->responseHeader->params)
42-
? json_encode($this->solrObject->responseHeader->params)
43-
: '{}';
44-
41+
$query = $this->result->getQuery()->getOptions();
42+
$fq = [];
43+
foreach ($query['filterquery'] as $q) { $fq[] = $q['query']; }
44+
$params = json_encode(['query'=>$query['query'], 'fq'=>$fq ]);
4545

4646
echo "
4747
<div id=\"location_map\"></div>
4848
<script type=\"text/javascript\">
4949
var CENTER_LATITUDE = $centerLatitude;
5050
var CENTER_LONGITUDE = $centerLongitude;
5151
var ZOOM = $zoom;
52-
var SOLR_PARAMS = $solr_params;
52+
var SOLR_PARAMS = $params;
5353
</script>
5454
";
5555

crm/public/js/tickets/searchResultsMap.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ google.maps.event.addDomListener(window, 'load', function () {
6464
},
6565
getSolrBaseUrl = function (coordinates) {
6666
var url = CRM.BASE_URI + '/solr?';
67-
url += SOLR_PARAMS.q ? 'q=' + SOLR_PARAMS.q : 'q=*.*';
68-
url += SOLR_PARAMS.sort ? '&sort=' + SOLR_PARAMS.sort : '';
67+
url += SOLR_PARAMS.q ? 'q=' + SOLR_PARAMS.q : 'q=*:*';
6968
url += getFqParameters() + '&fq=coordinates:' + coordinates;
7069
url += '&wt=json&json.nl=map';
7170
return url;

crm/src/Application/Controllers/SolrController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* This proxy URL provides a solution for both these problems.
99
* Request parameters are forwarded to the /solr/select? url
1010
*
11-
* @copyright 2013 City of Bloomington, Indiana
11+
* @copyright 2013-2021 City of Bloomington, Indiana
1212
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE
13-
* @author Cliff Ingham <[email protected]>
1413
*/
1514
namespace Application\Controllers;
1615

@@ -29,9 +28,9 @@ public function index()
2928
}
3029

3130
$protocol = SOLR_SERVER_PORT==443 ? 'http://' : 'http://';
32-
$url = $protocol.SOLR_SERVER_HOSTNAME;
31+
$url = $protocol.SOLR_SERVER_HOST;
3332
if (SOLR_SERVER_PORT != 80) { $url.= ':'.SOLR_SERVER_PORT; }
34-
$url.= SOLR_SERVER_PATH.'/select?'.$_SERVER['QUERY_STRING'];
33+
$url.= '/solr/'.SOLR_SERVER_CORE.'/select?'.$_SERVER['QUERY_STRING'];
3534

3635
echo Url::get($url);
3736
exit();

0 commit comments

Comments
 (0)