jenkins-bot has submitted this change and it was merged.

Change subject: Optional coordinates compression mode
......................................................................


Optional coordinates compression mode

Change-Id: I6c832390691e8e0d40f05acd8b516d8550977578
---
M GeoData.php
M GeoDataHooks.php
2 files changed, 15 insertions(+), 2 deletions(-)

Approvals:
  MaxSem: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/GeoData.php b/GeoData.php
index 36b7437..978a08a 100644
--- a/GeoData.php
+++ b/GeoData.php
@@ -249,4 +249,11 @@
 /**
  * Controls whether Elasticsearch searches should use indexed bounding box 
optimization.
  */
-$wgGeoDataIndexLatLon = true;
\ No newline at end of file
+$wgGeoDataIndexLatLon = true;
+
+/**
+ * Lossy coordinate compression for Elasticsearch backend
+ * Possible values: false (no compression), '1mm', '1cm', '3m', '1km'
+ * @see 
http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/mapping-geo-point-type.html#_field_data
+ */
+$wgGeoDataCoordinatesCompression = false;
diff --git a/GeoDataHooks.php b/GeoDataHooks.php
index 4286be1..3f3181f 100644
--- a/GeoDataHooks.php
+++ b/GeoDataHooks.php
@@ -292,7 +292,7 @@
         * @return bool
         */
        public static function onCirrusSearchMappingConfig( array &$config ) {
-               global $wgGeoDataUseCirrusSearch, $wgGeoDataBackend;
+               global $wgGeoDataUseCirrusSearch, $wgGeoDataBackend, 
$wgGeoDataCoordinatesCompression;
                if ( !$wgGeoDataUseCirrusSearch && $wgGeoDataBackend != 
'elastic' ) {
                        return true;
                }
@@ -312,6 +312,12 @@
                                'region' => array( 'type' => 'string', 'index' 
=> 'not_analyzed' ),
                        ),
                );
+               if ( $wgGeoDataCoordinatesCompression ) {
+                       
$config['properties']['coordinates']['properties']['coord']['fielddata'] = 
array(
+                               'format' => 'compressed',
+                               'precision' => $wgGeoDataCoordinatesCompression,
+                       );
+               }
                return true;
        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/124008
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6c832390691e8e0d40f05acd8b516d8550977578
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/extensions/GeoData
Gerrit-Branch: master
Gerrit-Owner: MaxSem <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Kaldari <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to