Package org.apache.nutch.indexer.geoip
Class GeoIPDocumentCreator
java.lang.Object
org.apache.nutch.indexer.geoip.GeoIPDocumentCreator
Simple utility class which builds a
NutchDocument based on input from
GeoIPIndexingFilter, where configuration is also read.
-
Method Summary
Modifier and TypeMethodDescriptionstatic NutchDocumentcreateDocFromAnonymousIpDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in Anonymous IP database.static NutchDocumentcreateDocFromAsnDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in ASN database.static NutchDocumentcreateDocFromCityDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in City database.static NutchDocumentcreateDocFromConnectionDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in ConnectionDb.static NutchDocumentcreateDocFromCountryDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in Country database.static NutchDocumentcreateDocFromDomainDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in Domain database.static NutchDocumentcreateDocFromInsightsService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client) Populate aNutchDocumentbased on lookup of IP using the MaxMind Insights web service.static NutchDocumentcreateDocFromIspDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) Populate aNutchDocumentbased on lookup of IP in ISP database.
-
Method Details
-
createDocFromAnonymousIpDb
public static NutchDocument createDocFromAnonymousIpDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in Anonymous IP database.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromAsnDb
public static NutchDocument createDocFromAsnDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in ASN database.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromCityDb
public static NutchDocument createDocFromCityDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in City database.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromConnectionDb
public static NutchDocument createDocFromConnectionDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in ConnectionDb.- Parameters:
serverIp- the server IPdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromCountryDb
public static NutchDocument createDocFromCountryDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in Country database. This is a lighter-weight alternative to the City database when only country-level information is needed.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromDomainDb
public static NutchDocument createDocFromDomainDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in Domain database.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromInsightsService
public static NutchDocument createDocFromInsightsService(String serverIp, NutchDocument doc, com.maxmind.geoip2.WebServiceClient client) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP using the MaxMind Insights web service.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populateclient- WebServiceClient for MaxMind Insights API- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-
createDocFromIspDb
public static NutchDocument createDocFromIspDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception Populate aNutchDocumentbased on lookup of IP in ISP database.- Parameters:
serverIp- the server IP address to lookupdoc- NutchDocument to populatereader- instantiated DatabaseReader object- Returns:
- populated NutchDocument
- Throws:
IOException- if an error occurs performing the Db lookupcom.maxmind.geoip2.exception.GeoIp2Exception- generic GeoIp2 exception
-