Package org.apache.nutch.indexer.geoip
Class GeoIPIndexingFilter
java.lang.Object
org.apache.nutch.indexer.geoip.GeoIPIndexingFilter
- All Implemented Interfaces:
Closeable,AutoCloseable,Configurable,IndexingFilter,Pluggable
This plugin implements an indexing filter which takes advantage of the GeoIP2-java API.
The third party library distribution provides an API for the GeoIP2 Precision web services, GeoLite2 (free) and databases.
Multiple databases can be configured simultaneously. Configure each database type you want to use by setting its corresponding property:
index.geoip.db.anonymous- Anonymous IP databaseindex.geoip.db.asn- ASN databaseindex.geoip.db.city- City databaseindex.geoip.db.connection- Connection Type databaseindex.geoip.db.country- Country databaseindex.geoip.db.domain- Domain databaseindex.geoip.db.isp- ISP database
Alternatively, use the MaxMind Insights web service by setting
index.geoip.insights.userid and index.geoip.insights.licensekey.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported GeoIP database types. -
Field Summary
Fields inherited from interface org.apache.nutch.indexer.IndexingFilter
X_POINT_ID -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks) Adds fields or otherwise modifies the document that will be indexed for a parse.getConf()voidsetConf(Configuration config)
-
Constructor Details
-
GeoIPIndexingFilter
public GeoIPIndexingFilter()Default constructor for this plugin
-
-
Method Details
-
getConf
- Specified by:
getConfin interfaceConfigurable
-
setConf
- Specified by:
setConfin interfaceConfigurable
-
filter
public NutchDocument filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks) throws IndexingException Description copied from interface:IndexingFilterAdds fields or otherwise modifies the document that will be indexed for a parse. Unwanted documents can be removed from indexing by returning a null value.- Specified by:
filterin interfaceIndexingFilter- Parameters:
doc- document instance for collecting fieldsparse- parse data instanceurl- page urldatum- crawl datum for the page (fetch datum from segment containing fetch status and fetch time)inlinks- page inlinks- Returns:
- modified (or a new) document instance, or null (meaning the document should be discarded)
- Throws:
IndexingException- if an error occurs during during filtering
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-