Package org.opensextant.util
Class SolrUtil
java.lang.Object
org.opensextant.util.SolrUtil
- Direct Known Subclasses:
SolrProxy
Utility functions better suited in their own class.
- Author:
- ubaldino
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.opensextant.data.PlacecreatePlace(org.apache.solr.common.SolrDocument gazEntry) Creates the bare minimum Gazetteer Place recordstatic charstatic double[]getCoordinate(String xy) Parse XY pair stored in Solr Spatial4J record.static double[]getCoordinate(org.apache.solr.common.SolrDocument solrDoc, String field) Parse XY pair stored in Solr Spatial4J record.static DateGet a Date object from a recordstatic doubleGet a double from a recordstatic FloatGet a floating point object from a recordstatic Floatstatic intgetInteger(org.apache.solr.common.SolrDocument d, String f) Get an integer from a recordstatic intgetInteger(org.apache.solr.common.SolrInputDocument d, String f) get integer value from input document.static longGet a long from a recordstatic StringGet a String object from a recordstatic StringGet a String object from a record on input.getStrings(org.apache.solr.common.SolrDocument d, String f) static voidpopulatePlace(org.apache.solr.common.SolrDocument gazEntry, org.opensextant.data.Place geo) Populate the data card.
-
Constructor Details
-
SolrUtil
public SolrUtil()
-
-
Method Details
-
getStrings
- Parameters:
d- solr docf- field name- Returns:
- a list of strings for this field from that document.; Or null if none found.
-
getInteger
Get an integer from a record -
getInteger
get integer value from input document.- Parameters:
d- docf- field name- Returns:
- int
-
getLong
Get a long from a record -
getFloat
Get a floating point object from a record- Returns:
- NaN if null
-
getFloat
-
getDate
Get a Date object from a record- Throws:
ParseException- if DateUtil fails to parse date str
-
getChar
-
getString
Get a String object from a record on input.- Parameters:
solrDoc- solr input document
-
getString
Get a String object from a record- Parameters:
solrDoc- SolrDocument from index
-
getDouble
Get a double from a record -
getCoordinate
Parse XY pair stored in Solr Spatial4J record. No validation is done.- Returns:
- XY double array, [lat, lon]
-
getCoordinate
Parse XY pair stored in Solr Spatial4J record. No validation is done.- Returns:
- XY double array, [lat, lon]
-
createPlace
public static org.opensextant.data.Place createPlace(org.apache.solr.common.SolrDocument gazEntry) Creates the bare minimum Gazetteer Place record- Parameters:
gazEntry- a solr document of key/value pairs- Returns:
- Place obj
-
populatePlace
public static void populatePlace(org.apache.solr.common.SolrDocument gazEntry, org.opensextant.data.Place geo) Populate the data card.- Parameters:
gazEntry- solr docgeo- place obj to populate
-