Author: mattmann
Date: Sun Dec 20 17:29:49 2015
New Revision: 1721048

URL: http://svn.apache.org/viewvc?rev=1721048&view=rev
Log:
Fix for TIKA-1803 Use lucene-geo-gazetteer REST API in GeoTopicParser 
contributed by Madhav Sharan [email protected] this closes #65

Added:
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/Location.java
    tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/
    tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/
    
tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/GeoTopicConfig.properties
Modified:
    tika/trunk/CHANGES.txt
    tika/trunk/tika-bundle/pom.xml
    tika/trunk/tika-parsers/pom.xml
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParser.java
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParserConfig.java
    
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoTag.java
    
tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/geo/topic/GeoParserTest.java

Modified: tika/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/tika/trunk/CHANGES.txt?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- tika/trunk/CHANGES.txt (original)
+++ tika/trunk/CHANGES.txt Sun Dec 20 17:29:49 2015
@@ -1,5 +1,9 @@
 Release 1.12 - Current Development
 
+  * A significant speed-up is made to the GeoTopicParser by
+    using the new REST server capabilities from Lucene Geo
+    Gazetteer (TIKA-1803).
+
   * A parser to compute motion properties in Videos, e.g., 
     Histogram of Oriented Gradients and Histogram of Optical Flows
     using the Pooled Time Series algorithm, was added (TIKA-1798).

Modified: tika/trunk/tika-bundle/pom.xml
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-bundle/pom.xml?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- tika/trunk/tika-bundle/pom.xml (original)
+++ tika/trunk/tika-bundle/pom.xml Sun Dec 20 17:29:49 2015
@@ -295,6 +295,7 @@
               ucar.unidata.io;resolution:=optional,
               ucar.unidata.util;resolution:=optional,
               com.jmatio.io;resolution:=optional,
+             com.google.gson;resolution:=optional,
               visad;resolution:=optional,
               visad.data;resolution:=optional,
               visad.data.vis5d;resolution:=optional,
@@ -330,6 +331,7 @@
               com.google.common.base;resolution:=optional,
               com.google.common.math;resolution:=optional,
               org.apache.http;resolution:=optional,
+             org.apache.http.client.utils;resolution:=optional,
               org.joda.time;resolution:=optional,
               org.joda.time.chrono;resolution:=optional,
               org.joda.time.field;resolution:=optional,

Modified: tika/trunk/tika-parsers/pom.xml
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/pom.xml?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- tika/trunk/tika-parsers/pom.xml (original)
+++ tika/trunk/tika-parsers/pom.xml Sun Dec 20 17:29:49 2015
@@ -275,7 +275,11 @@
       <artifactId>json</artifactId>
       <version>20140107</version>
     </dependency>
-    
+       <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>2.2.4</version>
+    </dependency>    
 
     <!-- Test dependencies -->
     <dependency>

Modified: 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParser.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParser.java?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParser.java
 (original)
+++ 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParser.java
 Sun Dec 20 17:29:49 2015
@@ -17,31 +17,23 @@
 
 package org.apache.tika.parser.geo.topic;
 
-import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.logging.Logger;
 
-import org.apache.commons.exec.CommandLine;
-import org.apache.commons.exec.DefaultExecutor;
-import org.apache.commons.exec.ExecuteException;
-import org.apache.commons.exec.ExecuteWatchdog;
-import org.apache.commons.exec.PumpStreamHandler;
-import org.apache.commons.exec.environment.EnvironmentUtils;
 import org.apache.tika.exception.TikaException;
 import org.apache.tika.metadata.Metadata;
 import org.apache.tika.mime.MediaType;
 import org.apache.tika.parser.AbstractParser;
 import org.apache.tika.parser.ParseContext;
-import org.apache.tika.parser.external.ExternalParser;
-import org.json.simple.JSONArray;
-import org.json.simple.JSONObject;
-import org.json.simple.JSONValue;
+import org.apache.tika.parser.geo.topic.gazetteer.GeoGazetteerClient;
+import org.apache.tika.parser.geo.topic.gazetteer.Location;
 import org.xml.sax.ContentHandler;
 import org.xml.sax.SAXException;
 
@@ -54,7 +46,8 @@ public class GeoParser extends AbstractP
                                     Collections.singleton(MEDIA_TYPE);
     
     private GeoParserConfig config = new GeoParserConfig();
-
+    private GeoGazetteerClient gazetteerClient;
+    
     private boolean initialized;
     private URL modelUrl;
     private NameEntityExtractor extractor;
@@ -76,11 +69,12 @@ public class GeoParser extends AbstractP
         }
         
         this.modelUrl = modelUrl;
+        gazetteerClient = new GeoGazetteerClient(config);
         
         // Check if the NER model is available, and if the
         //  lucene-geo-gazetteer is available
-        this.available = modelUrl != null && ExternalParser.check(
-                new String[] { "lucene-geo-gazetteer", "--help" }, -1);
+        this.available = modelUrl != null && gazetteerClient.checkAvail();
+        
         if (this.available) {
             try {
                 this.extractor = new NameEntityExtractor(modelUrl);
@@ -112,7 +106,7 @@ public class GeoParser extends AbstractP
         String bestner = extractor.bestNameEntity;
 
         /*------------------------resolve geonames for each ner, store results 
in a hashmap---------------------*/
-        HashMap<String, ArrayList<String>> resolvedGeonames = 
searchGeoNames(locationNameEntities);
+        Map<String, List<Location>> resolvedGeonames = 
searchGeoNames(locationNameEntities);
 
         /*----------------store locationNameEntities and their geonames in a 
geotag, each input has one geotag---------------------*/
         GeoTag geotag = new GeoTag();
@@ -120,58 +114,22 @@ public class GeoParser extends AbstractP
 
         /* add resolved entities in metadata */
 
-        metadata.add("Geographic_NAME", geotag.Geographic_NAME);
-        metadata.add("Geographic_LONGITUDE", geotag.Geographic_LONGTITUDE);
-        metadata.add("Geographic_LATITUDE", geotag.Geographic_LATITUDE);
+        metadata.add("Geographic_NAME", geotag.location.getName());
+        metadata.add("Geographic_LONGITUDE", geotag.location.getLongitude());
+        metadata.add("Geographic_LATITUDE", geotag.location.getLatitude());
         for (int i = 0; i < geotag.alternatives.size(); ++i) {
             GeoTag alter = (GeoTag) geotag.alternatives.get(i);
-            metadata.add("Optional_NAME" + (i + 1), alter.Geographic_NAME);
+            metadata.add("Optional_NAME" + (i + 1), alter.location.getName());
             metadata.add("Optional_LONGITUDE" + (i + 1),
-                         alter.Geographic_LONGTITUDE);
+                         alter.location.getLongitude());
             metadata.add("Optional_LATITUDE" + (i + 1),
-                         alter.Geographic_LATITUDE);
+                         alter.location.getLatitude());
         }
     }
 
-    public HashMap<String, ArrayList<String>> searchGeoNames(
-            ArrayList<String> locationNameEntities) throws ExecuteException,
-            IOException {
-        CommandLine cmdLine = new CommandLine("lucene-geo-gazetteer");
-        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
-        cmdLine.addArgument("-s");
-        for (String name : locationNameEntities) {
-            cmdLine.addArgument(name);
-        }
-
-        LOG.fine("Executing: " + cmdLine);
-        DefaultExecutor exec = new DefaultExecutor();
-        exec.setExitValue(0);
-        ExecuteWatchdog watchdog = new ExecuteWatchdog(60000);
-        exec.setWatchdog(watchdog);
-        PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
-        exec.setStreamHandler(streamHandler);
-        int exitValue = exec.execute(cmdLine, 
EnvironmentUtils.getProcEnvironment());
-        String outputJson = outputStream.toString("UTF-8");
-        JSONArray json = (JSONArray) JSONValue.parse(outputJson);
-
-        HashMap<String, ArrayList<String>> returnHash = new HashMap<String, 
ArrayList<String>>();
-        for (int i = 0; i < json.size(); i++) {
-            JSONObject obj = (JSONObject) json.get(i);
-            for (Object key : obj.keySet()) {
-                String theKey = (String) key;
-                JSONArray vals = (JSONArray) obj.get(theKey);
-                ArrayList<String> stringVals = new ArrayList<String>(
-                        vals.size());
-                for (int j = 0; j < vals.size(); j++) {
-                    String val = (String) vals.get(j);
-                    stringVals.add(val);
-                }
-
-                returnHash.put(theKey, stringVals);
-            }
-        }
-
-        return returnHash;
+    public Map<String, List<Location>> searchGeoNames(
+            ArrayList<String> locationNameEntities) {
+       return gazetteerClient.getLocations(locationNameEntities);
     }
 
     public boolean isAvailable() {

Modified: 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParserConfig.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParserConfig.java?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParserConfig.java
 (original)
+++ 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoParserConfig.java
 Sun Dec 20 17:29:49 2015
@@ -18,16 +18,50 @@
 package org.apache.tika.parser.geo.topic;
 
 import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.Serializable;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.util.Properties;
+import java.util.logging.Logger;
 
 public class GeoParserConfig implements Serializable {
     private static final long serialVersionUID = -3167692634278575818L;
     private URL nerModelUrl = null;
+    private String gazetteerRestEndpoint = null;
+
+       private static final Logger LOG = 
Logger.getLogger(GeoParserConfig.class.getName());
 
     public GeoParserConfig() {
         this.nerModelUrl = 
GeoParserConfig.class.getResource("en-ner-location.bin");
+        init(this.getClass().getResourceAsStream("GeoTopicConfig.properties"));
+    }
+    
+    /**
+     * Initialize configurations from property files
+     * @param stream InputStream for GeoTopicConfig.properties
+     */
+    private void init(InputStream stream) {
+        if (stream == null) {
+            return;
+        }
+        Properties props = new Properties();
+
+        try {
+            props.load(stream);
+        } catch (IOException e) {
+               LOG.warning("GeoTopicConfig.properties not found in class 
path");
+        } finally {
+            if (stream != null) {
+                try {
+                    stream.close();
+                } catch (IOException ioe) {
+                       LOG.severe("Unable to close stream: " + 
ioe.getMessage());
+                }
+            }
+        }
+        setGazetteerRestEndpoint(props.getProperty("gazetter.rest.api", 
"http://localhost:8765";));
     }
 
     public void setNERModelPath(String path) {
@@ -50,4 +84,17 @@ public class GeoParserConfig implements
     public URL getNerModelUrl() {
         return nerModelUrl;
     }
+    /**
+     * @return REST endpoint for lucene-geo-gazetteer
+     */
+    public String getGazetteerRestEndpoint() {
+               return gazetteerRestEndpoint;
+       }
+    /**
+     * Configure REST endpoint for lucene-geo-gazetteer
+     * @param gazetteerRestEndpoint
+     */
+    public void setGazetteerRestEndpoint(String gazetteerRestEndpoint) {
+               this.gazetteerRestEndpoint = gazetteerRestEndpoint;
+       }
 }

Modified: 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoTag.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoTag.java?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoTag.java
 (original)
+++ 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/GeoTag.java
 Sun Dec 20 17:29:49 2015
@@ -18,18 +18,20 @@
 package org.apache.tika.parser.geo.topic;
 
 import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.tika.parser.geo.topic.gazetteer.Location;
 
 public class GeoTag {
-       String Geographic_NAME;
-       String Geographic_LONGTITUDE;
-       String Geographic_LATITUDE;
-       ArrayList<GeoTag> alternatives = new ArrayList<GeoTag>();
+       Location location = new Location();
+       List<GeoTag> alternatives = new ArrayList<GeoTag>();
 
        public void setMain(String name, String longitude, String latitude) {
-               Geographic_NAME = name;
-               Geographic_LONGTITUDE = longitude;
-               Geographic_LATITUDE = latitude;
+               this.location.setName(name);
+               this.location.setLatitude(longitude);
+               this.location.setLongitude(latitude);
+               
        }
 
        public void addAlternative(GeoTag geotag) {
@@ -44,20 +46,17 @@ public class GeoTag {
         * @param bestNER best name entity among all the extracted entities for 
the
         * input stream
         */
-       public void toGeoTag(HashMap<String, ArrayList<String>> 
resolvedGeonames,
+       public void toGeoTag(Map<String, List<Location>> resolvedGeonames,
                        String bestNER) {
 
                for (String key : resolvedGeonames.keySet()) {
-                       ArrayList<String> cur = resolvedGeonames.get(key);
+                       List<Location> cur = resolvedGeonames.get(key);
                        if (key.equals(bestNER)) {
-                               this.Geographic_NAME = cur.get(0);
-                               this.Geographic_LONGTITUDE = cur.get(1);
-                               this.Geographic_LATITUDE = cur.get(2);
+                               this.location = cur.get(0);
+                               
                        } else {
                                GeoTag alter = new GeoTag();
-                               alter.Geographic_NAME = cur.get(0);
-                               alter.Geographic_LONGTITUDE = cur.get(1);
-                               alter.Geographic_LATITUDE = cur.get(2);
+                               alter.location = cur.get(0);
                                this.addAlternative(alter);
                        }
                }

Added: 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java?rev=1721048&view=auto
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java
 (added)
+++ 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/GeoGazetteerClient.java
 Sun Dec 20 17:29:49 2015
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tika.parser.geo.topic.gazetteer;
+
+import java.lang.reflect.Type;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.apache.commons.io.Charsets;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.utils.URIBuilder;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.tika.parser.geo.topic.GeoParserConfig;
+
+import com.google.common.reflect.TypeToken;
+import com.google.gson.Gson;
+
+
+public class GeoGazetteerClient {
+       private static final String SEARCH_API = "/api/search";
+       private static final String SEARCH_PARAM = "s";
+       private static final String PING = "/api/ping";
+
+       private static final Logger LOG = 
Logger.getLogger(GeoGazetteerClient.class.getName());
+
+       private String url;
+       
+       /**
+        * Pass URL on which lucene-geo-gazetteer is available - eg. 
http://localhost:8765/api/search
+        * @param url
+        */
+       public GeoGazetteerClient(String url) {
+               this.url = url;
+       }
+       
+       public GeoGazetteerClient(GeoParserConfig config) {
+               this.url = config.getGazetteerRestEndpoint();
+       }
+       
+       /**
+        * Calls API of lucene-geo-gazetteer to search location name in 
gazetteer.
+        * @param locations List of locations to be searched in gazetteer
+        * @return Map of input location strings to gazetteer locations
+        */
+       public Map<String, List<Location>> getLocations(List<String> locations){
+               HttpClient httpClient = new DefaultHttpClient();
+               
+               try {
+                       URIBuilder uri = new URIBuilder(url+SEARCH_API);
+                       for(String loc: locations){
+                               uri.addParameter(SEARCH_PARAM, loc);
+                       }
+                       HttpGet httpGet = new HttpGet(uri.build());
+                       
+                       HttpResponse resp = httpClient.execute(httpGet);
+                       String respJson = 
IOUtils.toString(resp.getEntity().getContent(), Charsets.UTF_8);
+                       
+                       @SuppressWarnings("serial")
+                       Type typeDef = new TypeToken<Map<String, 
List<Location>>>(){}.getType();
+                       
+                       return new Gson().fromJson(respJson, typeDef);
+                       
+               } catch (Exception e) {
+                       LOG.severe(e.getMessage());
+               }
+               
+               return null;
+       }
+       
+       /**
+        * Ping lucene-geo-gazetteer API
+        * @return true if API is available else returns false
+        */
+       public boolean checkAvail() {
+               HttpClient httpClient = new DefaultHttpClient();
+               
+               try {
+                       HttpGet httpGet = new HttpGet(url + PING);
+                       
+                       HttpResponse resp = httpClient.execute(httpGet);
+                       if(resp.getStatusLine().getStatusCode() == 200){
+                               return true;
+                       }
+                       
+               } catch (Exception e) {
+                       LOG.severe(e.getMessage());
+               }
+               
+               return false;
+       }
+       
+}

Added: 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/Location.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/Location.java?rev=1721048&view=auto
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/Location.java
 (added)
+++ 
tika/trunk/tika-parsers/src/main/java/org/apache/tika/parser/geo/topic/gazetteer/Location.java
 Sun Dec 20 17:29:49 2015
@@ -0,0 +1,71 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.tika.parser.geo.topic.gazetteer;
+
+import java.io.Serializable;
+
+public class Location implements Serializable{
+
+       private static final long serialVersionUID = -59485448766406004L;
+       
+       private String name;
+       private String countryCode;
+       private String admin1Code;
+       private String admin2Code;
+       private String latitude;
+       private String longitude;
+       
+       
+       public String getName() {
+               return name;
+       }
+       public void setName(String name) {
+               this.name = name;
+       }
+       public String getCountryCode() {
+               return countryCode;
+       }
+       public void setCountryCode(String countryCode) {
+               this.countryCode = countryCode;
+       }
+       public String getAdmin1Code() {
+               return admin1Code;
+       }
+       public void setAdmin1Code(String admin1Code) {
+               this.admin1Code = admin1Code;
+       }
+       public String getAdmin2Code() {
+               return admin2Code;
+       }
+       public void setAdmin2Code(String admin2Code) {
+               this.admin2Code = admin2Code;
+       }
+       public String getLatitude() {
+               return latitude;
+       }
+       public void setLatitude(String latitude) {
+               this.latitude = latitude;
+       }
+       public String getLongitude() {
+               return longitude;
+       }
+       public void setLongitude(String longitude) {
+               this.longitude = longitude;
+       }
+
+}

Added: 
tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/GeoTopicConfig.properties
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/GeoTopicConfig.properties?rev=1721048&view=auto
==============================================================================
--- 
tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/GeoTopicConfig.properties
 (added)
+++ 
tika/trunk/tika-parsers/src/main/resources/org/apache/tika/parser/geo/topic/GeoTopicConfig.properties
 Sun Dec 20 17:29:49 2015
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+gazetter.rest.api=http://localhost:8765

Modified: 
tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/geo/topic/GeoParserTest.java
URL: 
http://svn.apache.org/viewvc/tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/geo/topic/GeoParserTest.java?rev=1721048&r1=1721047&r2=1721048&view=diff
==============================================================================
--- 
tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/geo/topic/GeoParserTest.java
 (original)
+++ 
tika/trunk/tika-parsers/src/test/java/org/apache/tika/parser/geo/topic/GeoParserTest.java
 Sun Dec 20 17:29:49 2015
@@ -63,10 +63,10 @@ public class GeoParserTest {
                assertNotNull(metadata.get("Geographic_NAME"));
                assertNotNull(metadata.get("Geographic_LONGITUDE"));
                assertNotNull(metadata.get("Geographic_LATITUDE"));
-               assertEquals("China", metadata.get("Geographic_NAME"));
+               assertEquals("People’s Republic of China", 
metadata.get("Geographic_NAME"));
                assertEquals("United States", metadata.get("Optional_NAME1"));
-               assertEquals("27.33931", metadata.get("Geographic_LATITUDE"));
-               assertEquals("-108.60288", 
metadata.get("Geographic_LONGITUDE"));
+               assertEquals("35.0", metadata.get("Geographic_LATITUDE"));
+               assertEquals("105.0", metadata.get("Geographic_LONGITUDE"));
                assertEquals("39.76", metadata.get("Optional_LATITUDE1"));
                assertEquals("-98.5", metadata.get("Optional_LONGITUDE1"));
 


Reply via email to