本文整理汇总了C#中Version.onOrAfter方法的典型用法代码示例。如果您正苦于以下问题:C# Version.onOrAfter方法的具体用法?C# Version.onOrAfter怎么用?C# Version.onOrAfter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Version
的用法示例。
在下文中一共展示了Version.onOrAfter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NGramTokenFilter
/// <summary>
/// Creates NGramTokenFilter with given min and max n-grams. </summary>
/// <param name="version"> Lucene version to enable correct position increments.
/// See <a href="#version">above</a> for details. </param>
/// <param name="input"> <seealso cref="TokenStream"/> holding the input to be tokenized </param>
/// <param name="minGram"> the smallest n-gram to generate </param>
/// <param name="maxGram"> the largest n-gram to generate </param>
public NGramTokenFilter(Version version, TokenStream input, int minGram, int maxGram) : base(new CodepointCountFilter(version, input, minGram, int.MaxValue))
{
this.version = version;
this.charUtils = version.onOrAfter(Version.LUCENE_44) ? CharacterUtils.getInstance(version) : CharacterUtils.Java4Instance;
if (minGram < 1)
{
throw new System.ArgumentException("minGram must be greater than zero");
}
if (minGram > maxGram)
{
throw new System.ArgumentException("minGram must not be greater than maxGram");
}
this.minGram = minGram;
this.maxGram = maxGram;
if (version.onOrAfter(Version.LUCENE_44))
{
posIncAtt = addAttribute(typeof(PositionIncrementAttribute));
posLenAtt = addAttribute(typeof(PositionLengthAttribute));
}
else
{
posIncAtt = new PositionIncrementAttributeAnonymousInnerClassHelper(this);
posLenAtt = new PositionLengthAttributeAnonymousInnerClassHelper(this);
}
}
示例2: WordDelimiterFilter
/// <summary>
/// Creates a new WordDelimiterFilter
/// </summary>
/// <param name="in"> TokenStream to be filtered </param>
/// <param name="charTypeTable"> table containing character types </param>
/// <param name="configurationFlags"> Flags configuring the filter </param>
/// <param name="protWords"> If not null is the set of tokens to protect from being delimited </param>
public WordDelimiterFilter(Version matchVersion, TokenStream @in, sbyte[] charTypeTable, int configurationFlags, CharArraySet protWords)
: base(@in)
{
if (!InstanceFieldsInitialized)
{
InitializeInstanceFields();
InstanceFieldsInitialized = true;
}
if (!matchVersion.onOrAfter(Version.LUCENE_48))
{
throw new System.ArgumentException("This class only works with Lucene 4.8+. To emulate the old (broken) behavior of WordDelimiterFilter, use Lucene47WordDelimiterFilter");
}
this.flags = configurationFlags;
this.protWords = protWords;
this.iterator = new WordDelimiterIterator(charTypeTable, has(SPLIT_ON_CASE_CHANGE), has(SPLIT_ON_NUMERICS), has(STEM_ENGLISH_POSSESSIVE));
}
示例3: getScannerFor
private StandardTokenizerInterface getScannerFor(Version matchVersion)
{
// best effort NPE if you dont call reset
if (matchVersion.onOrAfter(Version.LUCENE_47))
{
return new UAX29URLEmailTokenizerImpl(input);
}
else if (matchVersion.onOrAfter(Version.LUCENE_40))
{
return new UAX29URLEmailTokenizerImpl40(input);
}
else if (matchVersion.onOrAfter(Version.LUCENE_36))
{
return new UAX29URLEmailTokenizerImpl36(input);
}
else if (matchVersion.onOrAfter(Version.LUCENE_34))
{
return new UAX29URLEmailTokenizerImpl34(input);
}
else
{
return new UAX29URLEmailTokenizerImpl31(input);
}
}