From e8c1a3a965ed964fae28b0daeb2131c2941577ef Mon Sep 17 00:00:00 2001
From: Leila Gonzales <lmg@agiweb.org>
Date: Wed, 21 Jun 2017 13:37:02 -0700
Subject: [PATCH] Rename location_geo to long_lat; add geo dynamic fields.
 (#996)

---
 config/vufind/facets.ini                                | 2 +-
 import/index_java/src/org/vufind/index/GeoTools.java    | 4 ++--
 import/marc_local.properties                            | 2 +-
 module/VuFind/src/VuFind/Recommend/MapSelection.php     | 2 +-
 module/VuFind/src/VuFind/RecordDriver/SolrDefault.php   | 4 ++--
 module/VuFind/src/VuFind/RecordTab/Map.php              | 2 +-
 module/VuFind/src/VuFind/View/Helper/Root/GeoCoords.php | 2 +-
 solr/vufind/biblio/conf/schema.xml                      | 7 ++++---
 tests/data/geo.mrc.properties                           | 2 +-
 9 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/config/vufind/facets.ini b/config/vufind/facets.ini
index a8eb0380da2..a9c5279d401 100644
--- a/config/vufind/facets.ini
+++ b/config/vufind/facets.ini
@@ -27,7 +27,7 @@ topic_facet        = "Suggested Topics"
 ; of VuFind other than the facet lists defined in this file (for example, the
 ; hierarchical browse of the BrowseController, or the Geographic Search).
 [ExtraFacetLabels]
-location_geo = "Geographic Search" 
+long_lat = "Geographic Search"
 
 ; This section is used to identify facets for special treatment by the SideFacets
 ; recommendations module.
diff --git a/import/index_java/src/org/vufind/index/GeoTools.java b/import/index_java/src/org/vufind/index/GeoTools.java
index bd34163409f..d04aa161321 100644
--- a/import/index_java/src/org/vufind/index/GeoTools.java
+++ b/import/index_java/src/org/vufind/index/GeoTools.java
@@ -51,7 +51,7 @@ public class GeoTools
     static Logger logger = Logger.getLogger(GeoTools.class.getName());
 
     /**
-     * Convert MARC coordinates into location_geo format.
+     * Convert MARC coordinates into long_lat format.
      *
      * @param  Record record
      * @return List   geo_coordinates
@@ -376,4 +376,4 @@ public class GeoTools
         }
         return true;
     }
-}
\ No newline at end of file
+}
diff --git a/import/marc_local.properties b/import/marc_local.properties
index 614afe80146..6beb5bc092e 100644
--- a/import/marc_local.properties
+++ b/import/marc_local.properties
@@ -31,7 +31,7 @@
 # and OpenLayers3 Geo-Display functionality
 # See searches.ini for configuration options for Geographic Searching.
 # See config.ini for configuration options for Geo-Display.
-#location_geo = custom, getAllCoordinates
+#long_lat = custom, getAllCoordinates
 #long_lat_display = custom, getDisplayCoordinates
 #long_lat_label = 034z
 
diff --git a/module/VuFind/src/VuFind/Recommend/MapSelection.php b/module/VuFind/src/VuFind/Recommend/MapSelection.php
index 2a202ac9adc..eb22e9ae122 100644
--- a/module/VuFind/src/VuFind/Recommend/MapSelection.php
+++ b/module/VuFind/src/VuFind/Recommend/MapSelection.php
@@ -52,7 +52,7 @@ class MapSelection implements \VuFind\Recommend\RecommendInterface
      *
      * @var string
      */
-    protected $geoField = 'location_geo';
+    protected $geoField = 'long_lat';
 
     /**
      * Height of search map pane
diff --git a/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php b/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php
index 3331930eb74..5d8d0c9411e 100644
--- a/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php
+++ b/module/VuFind/src/VuFind/RecordDriver/SolrDefault.php
@@ -1938,8 +1938,8 @@ class SolrDefault extends AbstractBase
      */
     public function getGeoLocation()
     {
-        return isset($this->fields['location_geo'])
-            ? $this->fields['location_geo'] : [];
+        return isset($this->fields['long_lat'])
+            ? $this->fields['long_lat'] : [];
     }
 
     /**
diff --git a/module/VuFind/src/VuFind/RecordTab/Map.php b/module/VuFind/src/VuFind/RecordTab/Map.php
index 017e504665e..db8b69a3452 100644
--- a/module/VuFind/src/VuFind/RecordTab/Map.php
+++ b/module/VuFind/src/VuFind/RecordTab/Map.php
@@ -140,7 +140,7 @@ class Map extends AbstractBase
             return [];
         }
         $coordarray = [];
-        /* Extract coordinates from location_geo field */
+        /* Extract coordinates from long_lat field */
         foreach ($geoCoords as $value) {
             $match = [];
             if (preg_match('/ENVELOPE\((.*),(.*),(.*),(.*)\)/', $value, $match)) {
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/GeoCoords.php b/module/VuFind/src/VuFind/View/Helper/Root/GeoCoords.php
index ed372fab0bc..b5ae5296247 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/GeoCoords.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/GeoCoords.php
@@ -58,7 +58,7 @@ class GeoCoords extends \Zend\View\Helper\AbstractHelper
      *
      * @var string
      */
-    protected $geoField = 'location_geo';
+    protected $geoField = 'long_lat';
 
     /**
      * Constructor
diff --git a/solr/vufind/biblio/conf/schema.xml b/solr/vufind/biblio/conf/schema.xml
index f218689ed5a..97a72e3a8e2 100644
--- a/solr/vufind/biblio/conf/schema.xml
+++ b/solr/vufind/biblio/conf/schema.xml
@@ -189,7 +189,8 @@
    <field name="era" type="text" indexed="true" stored="true" multiValued="true"/>
    <field name="era_facet" type="textFacet" indexed="true" stored="true" multiValued="true"/>
    <field name="illustrated" type="string" indexed="true" stored="true" multiValued="false"/>
-   <!-- Used for geographic map display -->
+   <!-- Used for geographic search and display fields -->
+   <field name="long_lat" type="geo" indexed="true" stored="true" multiValued="true" />
    <field name="long_lat_display" type="text" indexed="true" stored="true" multiValued="true"/>
    <field name="long_lat_label" type="string" indexed="false" stored="true" multiValued="true"/>
    <!-- Container fields (i.e. for describing journal containing an article) -->
@@ -229,8 +230,8 @@
    <dynamicField name="*_txtP_mv" type="textProper" indexed="true" stored="true" multiValued="true"/>
    <dynamicField name="*_random" type="random" />
    <dynamicField name="*_boolean" type="boolean" indexed="true" stored="true"/>
-   <!-- add geo field to handle geographic search and display capabilities -->
-   <dynamicField name="*_geo" type="geo" indexed="true" stored="true" multiValued="true" />
+   <dynamicField name="*_geo" type="geo" indexed="true" stored="true" multiValued="false" />
+   <dynamicField name="*_geo_mv" type="geo" indexed="true" stored="true" multiValued="true" />
  </fields>
  <uniqueKey>id</uniqueKey>
  <!-- CopyFields for Spelling -->
diff --git a/tests/data/geo.mrc.properties b/tests/data/geo.mrc.properties
index d6ebed82f3f..6ef41c73276 100644
--- a/tests/data/geo.mrc.properties
+++ b/tests/data/geo.mrc.properties
@@ -1,5 +1,5 @@
 id = 001, (pattern_map.id_prefix), first
 pattern_map.id_prefix.pattern_0 = (.+)=>geo$1
-location_geo = custom, getAllCoordinates
+long_lat = custom, getAllCoordinates
 long_lat_display = custom, getDisplayCoordinates
 long_lat_label = 034z
-- 
GitLab