Package org.apache.nutch.indexer.geoip
Class GeoIPDocumentCreator
- java.lang.Object
-
- org.apache.nutch.indexer.geoip.GeoIPDocumentCreator
-
public class GeoIPDocumentCreator extends Object
Simple utility class which enables efficient, structured
NutchDocumentbuilding based on input fromGeoIPIndexingFilter, where configuration is also read.Based on the nature of the input, this class wraps factory type implementations for populating
NutchDocument's with the correctNutchFieldinformation.
-
-
Constructor Summary
Constructors Constructor Description GeoIPDocumentCreator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddIfNotNull(NutchDocument doc, String name, Object value)Add field to document but only if value isn't nullstatic NutchDocumentcreateDocFromCityDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader)static NutchDocumentcreateDocFromCityService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client)static NutchDocumentcreateDocFromConnectionDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader)static NutchDocumentcreateDocFromCountryService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client)static NutchDocumentcreateDocFromDomainDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader)static NutchDocumentcreateDocFromInsightsService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client)static NutchDocumentcreateDocFromIspDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader)
-
-
-
Method Detail
-
addIfNotNull
public static void addIfNotNull(NutchDocument doc, String name, Object value)
Add field to document but only if value isn't null- Parameters:
doc- theNutchDocumentto augmentname- the name of the target fieldvalue- the String value to associate with the target field
-
createDocFromInsightsService
public static NutchDocument createDocFromInsightsService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromCityService
public static NutchDocument createDocFromCityService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromCountryService
public static NutchDocument createDocFromCountryService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromIspDb
public static NutchDocument createDocFromIspDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromDomainDb
public static NutchDocument createDocFromDomainDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromConnectionDb
public static NutchDocument createDocFromConnectionDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
createDocFromCityDb
public static NutchDocument createDocFromCityDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws UnknownHostException, IOException, com.maxmind.geoip2.exception.GeoIp2Exception
- Throws:
UnknownHostExceptionIOExceptioncom.maxmind.geoip2.exception.GeoIp2Exception
-
-