DateRecognizerSinkTokenizer (Lucene 2.4.1 API)
Keywords: org.apache.lucene.analysis.sinks.DateRecognizerSinkTokenizer class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.analysis.sinks
Class DateRecognizerSinkTokenizer

    java.lang.Object
      org.apache.lucene.analysis.TokenStream
          org.apache.lucene.analysis.Tokenizer
              org.apache.lucene.analysis.SinkTokenizer
                  org.apache.lucene.analysis.sinks.DateRecognizerSinkTokenizer

    public class DateRecognizerSinkTokenizer

extends SinkTokenizer

Attempts to parse the `Token.termBuffer()` as a Date using a `DateFormat`. If the value is a Date, it will add it to the sink.

Also marks the sink token with `Token.type()` equal to `DATE_TYPE`

Field Summary
`static String` | `DATE_TYPE`
`protected DateFormat` | `dateFormat`

Fields inherited from class org.apache.lucene.analysis.SinkTokenizer
`iter, lst`

Fields inherited from class org.apache.lucene.analysis.Tokenizer
`input`

Constructor Summary
`DateRecognizerSinkTokenizer()` Uses `DateFormat.getDateInstance()` as the `DateFormat` object.
`DateRecognizerSinkTokenizer(DateFormat dateFormat)`
`DateRecognizerSinkTokenizer(List input)` Uses `DateFormat.getDateInstance()` as the `DateFormat` object.
`DateRecognizerSinkTokenizer(List input, DateFormat dateFormat)`

Method Summary
`void` | `add(Token t)` Override this method to cache only certain tokens, or new tokens based on the old tokens.

Methods inherited from class org.apache.lucene.analysis.SinkTokenizer
`close, getTokens, next, reset`

Methods inherited from class org.apache.lucene.analysis.Tokenizer
`reset`

Methods inherited from class org.apache.lucene.analysis.TokenStream
`next`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DATE_TYPE

    public static final String DATE_TYPE

See Also:
  Constant Field Values

### dateFormat

    protected DateFormat dateFormat

Constructor Detail

### DateRecognizerSinkTokenizer

    public DateRecognizerSinkTokenizer()

  Uses `DateFormat.getDateInstance()` as the `DateFormat` object.

### DateRecognizerSinkTokenizer

    public DateRecognizerSinkTokenizer(DateFormat dateFormat)

### DateRecognizerSinkTokenizer

    public DateRecognizerSinkTokenizer(List input)

  Uses `DateFormat.getDateInstance()` as the `DateFormat` object.

  Parameters:
    `input` - The input list of Tokens that are already Dates. They should be marked as type `DATE_TYPE` for completeness

### DateRecognizerSinkTokenizer

    public DateRecognizerSinkTokenizer(List input,
                                       DateFormat dateFormat)

Parameters:
  `input` -
  `dateFormat` - The date format to use to try and parse the date. Note, this SinkTokenizer makes no attempt to synchronize the DateFormat object

Method Detail

### add

    public void add(Token t)

  Description copied from class: `SinkTokenizer`
  Override this method to cache only certain tokens, or new tokens based on the old tokens.

  Overrides:
    `add` in class `SinkTokenizer`
  Parameters:
    `t` - The `Token` to add to the sink

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.