Esri / geoportal-server

Geoportal Server is a standards-based, open source product that enables discovery and use of geospatial resources including data and services.
https://gptogc.esri.com/geoportal
Apache License 2.0
244 stars 149 forks source link

Index/Stats/Fields page not working for resource.url #241

Closed torrin47 closed 8 years ago

torrin47 commented 8 years ago

Something funky seems to be going on with the resource.url index - the index appears to be valid, and elements are mapped to the correct output, but the Index/Stats/Fields page produces null output. We'd conclude that it was just us: https://edg.epa.gov/metadata/rest/index/stats/fields?field=resource.url if it wasn't for the fact that the Esri sandbox server exhibits the exact same behavior: http://gptogc.esri.com/geoportal/rest/index/stats/fields?field=resource.url Other indices containing URLs work just fine: http://gptogc.esri.com/geoportal/rest/index/stats/fields?field=dcat.downloadUrl so it's not the nature of the indexed items. Thoughts? Here's what we're seeing in the log files.

Aug 12, 2016 5:00:19 PM com.esri.gpt.framework.context.BaseServlet doPost SEVERE: Exception occured while processing servlet request. java.lang.IllegalArgumentException: Comparison method violates its general contract! at java.util.TimSort.mergeLo(Unknown Source) at java.util.TimSort.mergeAt(Unknown Source) at java.util.TimSort.mergeCollapse(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.TimSort.sort(Unknown Source) at java.util.Arrays.sort(Unknown Source) at java.util.Collections.sort(Unknown Source) at com.esri.gpt.catalog.lucene.stats.FrequencyAccumulator.sortByFrequency(FrequencyAccumulator.java:78)

zguo commented 8 years ago

looks like this is related to a change in java 7, please see https://dertompson.com/2012/11/23/sort-algorithm-changes-in-java-7/

add following to tomcat jvm seems to address the issue:

-Djava.util.Arrays.useLegacyMergeSort=true

or you can append &sortBy=name to the end the stats should also show.

torrin47 commented 8 years ago

Hot dog, never would have found that on our own. Thanks!