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 `NutchDocument` building based on input from `GeoIPIndexingFilter`, where configuration is also read.

  Based on the nature of the input, this class wraps factory type implementations for populating `NutchDocument` 's with the correct `NutchField` information.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GeoIPDocumentCreator()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `addIfNotNull(NutchDocument doc, String name, Integer value)` Add field to document but only if value isn't null
    `static void` | `addIfNotNull(NutchDocument doc, String name, String value)` Add field to document but only if value isn't null
    `static NutchDocument` | `createDocFromCityDb(String serverIp, NutchDocument doc, DatabaseReader reader)`
    `static NutchDocument` | `createDocFromCityService(String serverIp, NutchDocument doc, WebServiceClient client)`
    `static NutchDocument` | `createDocFromConnectionDb(String serverIp, NutchDocument doc, DatabaseReader reader)`
    `static NutchDocument` | `createDocFromCountryService(String serverIp, NutchDocument doc, WebServiceClient client)`
    `static NutchDocument` | `createDocFromDomainDb(String serverIp, NutchDocument doc, DatabaseReader reader)`
    `static NutchDocument` | `createDocFromInsightsService(String serverIp, NutchDocument doc, WebServiceClient client)`
    `static NutchDocument` | `createDocFromIspDb(String serverIp, NutchDocument doc, DatabaseReader reader)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GeoIPDocumentCreator

          public GeoIPDocumentCreator()

  - ### Method Detail

    - #### addIfNotNull

          public static void addIfNotNull(NutchDocument doc,
                                          String name,
                                          String value)

      Add field to document but only if value isn't null

    - #### addIfNotNull

          public static void addIfNotNull(NutchDocument doc,
                                          String name,
                                          Integer value)

      Add field to document but only if value isn't null

    - #### createDocFromInsightsService

          public static NutchDocument createDocFromInsightsService(String serverIp,
                                                                   NutchDocument doc,
                                                                   WebServiceClient client)
                                                            throws UnknownHostException,
                                                                   IOException,
                                                                   GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromCityService

          public static NutchDocument createDocFromCityService(String serverIp,
                                                               NutchDocument doc,
                                                               WebServiceClient client)
                                                        throws UnknownHostException,
                                                               IOException,
                                                               GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromCountryService

          public static NutchDocument createDocFromCountryService(String serverIp,
                                                                  NutchDocument doc,
                                                                  WebServiceClient client)
                                                           throws UnknownHostException,
                                                                  IOException,
                                                                  GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromIspDb

          public static NutchDocument createDocFromIspDb(String serverIp,
                                                         NutchDocument doc,
                                                         DatabaseReader reader)
                                                  throws UnknownHostException,
                                                         IOException,
                                                         GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromDomainDb

          public static NutchDocument createDocFromDomainDb(String serverIp,
                                                            NutchDocument doc,
                                                            DatabaseReader reader)
                                                     throws UnknownHostException,
                                                            IOException,
                                                            GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromConnectionDb

          public static NutchDocument createDocFromConnectionDb(String serverIp,
                                                                NutchDocument doc,
                                                                DatabaseReader reader)
                                                         throws UnknownHostException,
                                                                IOException,
                                                                GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

    - #### createDocFromCityDb

          public static NutchDocument createDocFromCityDb(String serverIp,
                                                          NutchDocument doc,
                                                          DatabaseReader reader)
                                                   throws UnknownHostException,
                                                          IOException,
                                                          GeoIp2Exception

      Throws:
        `UnknownHostException`
        `IOException`
        `GeoIp2Exception`

Copyright © 2021 The Apache Software Foundation