Class ICUCollationKeyFilter
Converts each token into its ICU4N.Text.CollationKey, and then encodes the ICU4N.Text.CollationKey with Lucene.Net.Util.IndexableBinaryStringTools, to allow it to be stored as an index term.
Implements
Inherited Members
Namespace: Lucene.Net.Collation
Assembly: Lucene.Net.ICU.dll
Syntax
[Obsolete("Use ICUCollationAttributeFactory instead, which encodes terms directly as bytes. This filter will be removed in Lucene 5.0")]
public sealed class ICUCollationKeyFilter : TokenFilter, IDisposable
Remarks
WARNING: Make sure you use exactly the same ICU4N.Text.Collator at index and query time -- CollationKeys are only comparable when produced by the same ICU4N.Text.Collator. ICU4N.Text.RuleBasedCollators are independently versioned, so it is safe to search against stored ICU4N.Text.CollationKeys if the following are exactly the same (best practice is to store this information with the index and check that they remain the same at query time):
- Collator version - see ICU4N.Text.Collator Version
- The collation strength used - see ICU4N.Text.Collator.Strength
Constructors
ICUCollationKeyFilter(TokenStream, Collator)
Creates a new ICUCollationKeyFilter.
Declaration
public ICUCollationKeyFilter(TokenStream input, Collator collator)
Parameters
Type | Name | Description |
---|---|---|
TokenStream | input | Source token stream. |
Collator | collator | ICU4N.Text.CollationKey generator. |
Remarks
WARNING: Make sure you use exactly the same ICU4N.Text.Collator at index and query time -- CollationKeys are only comparable when produced by the same ICU4N.Text.Collator. ICU4N.Text.RuleBasedCollators are independently versioned, so it is safe to search against stored ICU4N.Text.CollationKeys if the following are exactly the same (best practice is to store this information with the index and check that they remain the same at query time):
- Collator version - see ICU4N.Text.Collator Version
- The collation strength used - see ICU4N.Text.Collator.Strength
Methods
IncrementToken()
Consumers (i.e., Lucene.Net.Index.IndexWriter) use this method to advance the stream to the next token. Implementing classes must implement this method and update the appropriate Lucene.Net.Util.IAttributes with the attributes of the next token.
The producer must make no assumptions about the attributes after the method has been returned: the caller may arbitrarily change it. If the producer needs to preserve the state for subsequent calls, it can use Lucene.Net.Util.AttributeSource.CaptureState() to create a copy of the current attribute state. this method is called for every token of a document, so an efficient implementation is crucial for good performance. To avoid calls to Lucene.Net.Util.AttributeSource.AddAttribute<T>() and Lucene.Net.Util.AttributeSource.GetAttribute<T>(), references to all Lucene.Net.Util.IAttributes that this stream uses should be retrieved during instantiation. To ensure that filters and consumers know which attributes are available, the attributes must be added during instantiation. Filters and consumers are not required to check for availability of attributes in Lucene.Net.Analysis.TokenStream.IncrementToken().Declaration
public override bool IncrementToken()
Returns
Type | Description |
---|---|
bool | false for end of stream; true otherwise |
Overrides
Remarks
WARNING: Make sure you use exactly the same ICU4N.Text.Collator at index and query time -- CollationKeys are only comparable when produced by the same ICU4N.Text.Collator. ICU4N.Text.RuleBasedCollators are independently versioned, so it is safe to search against stored ICU4N.Text.CollationKeys if the following are exactly the same (best practice is to store this information with the index and check that they remain the same at query time):
- Collator version - see ICU4N.Text.Collator Version
- The collation strength used - see ICU4N.Text.Collator.Strength