Class GeoIPDocumentCreator

java.lang.Object
org.apache.nutch.indexer.geoip.GeoIPDocumentCreator

public class GeoIPDocumentCreator extends Object

Simple utility class which builds a NutchDocument based on input from GeoIPIndexingFilter, where configuration is also read.

  • Method Details

    • createDocFromAnonymousIpDb

      public static NutchDocument createDocFromAnonymousIpDb(String serverIp, NutchDocument doc, com.maxmind.geoip2.DatabaseReader reader) throws IOException, com.maxmind.geoip2.exception.GeoIp2Exception
      Populate a NutchDocument based on lookup of IP in Anonymous IP database.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based on lookup of IP in ASN database.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based on lookup of IP in City database.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based on lookup of IP in ConnectionDb.
      Parameters:
      serverIp - the server IP
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based 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 lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based on lookup of IP in Domain database.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.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 a NutchDocument based on lookup of IP using the MaxMind Insights web service.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      client - WebServiceClient for MaxMind Insights API
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the lookup
      com.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 a NutchDocument based on lookup of IP in ISP database.
      Parameters:
      serverIp - the server IP address to lookup
      doc - NutchDocument to populate
      reader - instantiated DatabaseReader object
      Returns:
      populated NutchDocument
      Throws:
      IOException - if an error occurs performing the Db lookup
      com.maxmind.geoip2.exception.GeoIp2Exception - generic GeoIp2 exception