For extra performance you can globally enable the new {@link #IncrementToken} API using {@link Attribute}s. There will be a small, but in most cases negligible performance increase by enabling this, but it only works if all
CopyC#
TokenStream
s use the new API and implement {@link #IncrementToken}. This setting can only be enabled globally.

This setting only affects

CopyC#
TokenStream
s instantiated after this call. All
CopyC#
TokenStream
s already created use the other setting.

All core {@link Analyzer}s are compatible with this setting, if you have your own

CopyC#
TokenStream
s that are also compatible, you should enable this.

When enabled, tokenization may throw {@link UnsupportedOperationException} s, if the whole tokenizer chain is not compatible eg one of the

CopyC#
TokenStream
s does not implement the new
CopyC#
TokenStream
API.

The default is

CopyC#
false
, so there is the fallback to the old API available.

Namespace: Lucene.Net.Analysis
Assembly: Lucene.Net (in Lucene.Net.dll) Version: 2.9.4.1

Syntax

C#
[ObsoleteAttribute("This setting will no longer be needed in Lucene 3.0 as the old API will be removed.")]
public static void SetOnlyUseNewAPI(
	bool onlyUseNewAPI
)
Visual Basic
<ObsoleteAttribute("This setting will no longer be needed in Lucene 3.0 as the old API will be removed.")> _
Public Shared Sub SetOnlyUseNewAPI ( _
	onlyUseNewAPI As Boolean _
)
Visual C++
[ObsoleteAttribute(L"This setting will no longer be needed in Lucene 3.0 as the old API will be removed.")]
public:
static void SetOnlyUseNewAPI(
	bool onlyUseNewAPI
)

Parameters

onlyUseNewAPI
Type: System..::..Boolean

[Missing <param name="onlyUseNewAPI"/> documentation for "M:Lucene.Net.Analysis.TokenStream.SetOnlyUseNewAPI(System.Boolean)"]

See Also