org.apache.nutch.indexer.staticfield

## Class StaticFieldIndexer

- java.lang.Object
- - org.apache.nutch.indexer.staticfield.StaticFieldIndexer

- All Implemented Interfaces:
    Configurable, IndexingFilter, Pluggable

      public class StaticFieldIndexer
      extends Object
      implements IndexingFilter

  A simple plugin called at indexing that adds fields with static data. You can specify a list of fieldname:fieldcontent per nutch job. It can be useful when collections can't be created by urlpatterns, like in subcollection, but on a job-basis.

- - ### Field Summary

    - ### Fields inherited from interface org.apache.nutch.indexer.IndexingFilter

      `X_POINT_ID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StaticFieldIndexer()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `NutchDocument` | `filter(NutchDocument doc, Parse parse, Text url, CrawlDatum datum, Inlinks inlinks)` The `StaticFieldIndexer` filter object which adds fields as per configuration setting.
    `Configuration` | `getConf()` Get the `Configuration` object
    `protected String` | `regexEscape(String in)` Escapes any character that needs escaping so it can be used in a regexp.
    `void` | `setConf(Configuration conf)` Set the `Configuration` object

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

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

- - ### Constructor Detail

    - #### StaticFieldIndexer

          public StaticFieldIndexer()

  - ### Method Detail

    - #### filter

          public NutchDocument filter(NutchDocument doc,
                                      Parse parse,
                                      Text url,
                                      CrawlDatum datum,
                                      Inlinks inlinks)
                               throws IndexingException

      The `StaticFieldIndexer` filter object which adds fields as per configuration setting. See `index.static` in nutch-default.xml.
      Specified by:
        `filter` in interface `IndexingFilter`
      Parameters:
        `doc` - The `NutchDocument` object
        `parse` - The relevant `Parse` object passing through the filter
        `url` - URL to be filtered for anchor text
        `datum` - The `CrawlDatum` entry
        `inlinks` - The `Inlinks` containing anchor text
      Returns:
        filtered NutchDocument
      Throws:
        `IndexingException`

    - #### setConf

          public void setConf(Configuration conf)

      Set the `Configuration` object
      Specified by:
        `setConf` in interface `Configurable`

    - #### getConf

          public Configuration getConf()

      Get the `Configuration` object
      Specified by:
        `getConf` in interface `Configurable`

    - #### regexEscape

          protected String regexEscape(String in)

      Escapes any character that needs escaping so it can be used in a regexp.

Copyright © 2021 The Apache Software Foundation