當前位置: 首頁>>代碼示例>>Java>>正文


Java Version.onOrAfter方法代碼示例

本文整理匯總了Java中org.apache.lucene.util.Version.onOrAfter方法的典型用法代碼示例。如果您正苦於以下問題:Java Version.onOrAfter方法的具體用法?Java Version.onOrAfter怎麽用?Java Version.onOrAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.lucene.util.Version的用法示例。


在下文中一共展示了Version.onOrAfter方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: init

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
private void init(Version version, int minGram, int maxGram, boolean edgesOnly) {
  if (!version.onOrAfter(Version.LUCENE_4_4_0)) {
    throw new IllegalArgumentException("This class only works with Lucene 4.4+. To emulate the old (broken) behavior of NGramTokenizer, use Lucene43NGramTokenizer/Lucene43EdgeNGramTokenizer");
  }
  charUtils = version.onOrAfter(Version.LUCENE_4_4_0)
      ? CharacterUtils.getInstance(version)
      : CharacterUtils.getJava4Instance();
  if (minGram < 1) {
    throw new IllegalArgumentException("minGram must be greater than zero");
  }
  if (minGram > maxGram) {
    throw new IllegalArgumentException("minGram must not be greater than maxGram");
  }
  this.minGram = minGram;
  this.maxGram = maxGram;
  this.edgesOnly = edgesOnly;
  charBuffer = CharacterUtils.newCharacterBuffer(2 * maxGram + 1024); // 2 * maxGram in case all code points require 2 chars and + 1024 for buffering to not keep polling the Reader
  buffer = new int[charBuffer.getBuffer().length];
  // Make the term att large enough
  termAtt.resizeBuffer(2 * maxGram);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:NGramTokenizer.java

示例2: GermanAnalyzer

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated {@link #GermanAnalyzer()}
 */
@Deprecated
public GermanAnalyzer(Version matchVersion) {
  this(matchVersion,
      matchVersion.onOrAfter(Version.LUCENE_3_1) ? DefaultSetHolder.DEFAULT_SET
          : DefaultSetHolder.DEFAULT_SET_30);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:GermanAnalyzer.java

示例3: DutchAnalyzer

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #DutchAnalyzer(CharArraySet)}
 */
@Deprecated
public DutchAnalyzer(Version matchVersion, CharArraySet stopwords){
  // historically, this ctor never the stem dict!!!!!
  // so we populate it only for >= 3.6
  this(matchVersion, stopwords, CharArraySet.EMPTY_SET, 
      matchVersion.onOrAfter(Version.LUCENE_3_6) 
      ? DefaultSetHolder.DEFAULT_STEM_DICT 
      : CharArrayMap.<String>emptyMap());
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:DutchAnalyzer.java

示例4: init

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
private void init(Version version, Side side, int minGram, int maxGram) {
  if (version == null) {
    throw new IllegalArgumentException("version must not be null");
  }

  if (side == null) {
    throw new IllegalArgumentException("sideLabel must be either front or back");
  }

  if (minGram < 1) {
    throw new IllegalArgumentException("minGram must be greater than zero");
  }

  if (minGram > maxGram) {
    throw new IllegalArgumentException("minGram must not be greater than maxGram");
  }

  if (version.onOrAfter(Version.LUCENE_4_4)) {
    if (side == Side.BACK) {
      throw new IllegalArgumentException("Side.BACK is not supported anymore as of Lucene 4.4");
    }
  } else {
    maxGram = Math.min(maxGram, 1024);
  }

  this.minGram = minGram;
  this.maxGram = maxGram;
  this.side = side;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:30,代碼來源:Lucene43EdgeNGramTokenizer.java

示例5: EdgeNGramTokenFilter

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated For {@link Version#LUCENE_4_3_0} or below, use {@link Lucene43EdgeNGramTokenFilter}, otherwise use {@link #EdgeNGramTokenFilter(TokenStream, int, int)}
 */
@Deprecated
public EdgeNGramTokenFilter(Version version, TokenStream input, Side side, int minGram, int maxGram) {
  super(input);

  if (version.onOrAfter(Version.LUCENE_4_4) && side == Side.BACK) {
    throw new IllegalArgumentException("Side.BACK is not supported anymore as of Lucene 4.4, use ReverseStringFilter up-front and afterward");
  }

  if (side == null) {
    throw new IllegalArgumentException("sideLabel must be either front or back");
  }

  if (minGram < 1) {
    throw new IllegalArgumentException("minGram must be greater than zero");
  }

  if (minGram > maxGram) {
    throw new IllegalArgumentException("minGram must not be greater than maxGram");
  }

  this.version = version;
  this.charUtils = version.onOrAfter(Version.LUCENE_4_4)
      ? CharacterUtils.getInstance(version)
      : CharacterUtils.getJava4Instance();
  this.minGram = minGram;
  this.maxGram = maxGram;
  this.side = side;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:32,代碼來源:EdgeNGramTokenFilter.java

示例6: RussianAnalyzer

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #RussianAnalyzer()}
 */
@Deprecated
public RussianAnalyzer(Version matchVersion) {
  this(matchVersion,
    matchVersion.onOrAfter(Version.LUCENE_3_1) ? DefaultSetHolder.DEFAULT_STOP_SET
        : DefaultSetHolder.DEFAULT_STOP_SET_30);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:RussianAnalyzer.java

示例7: init

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
private final void init(Version matchVersion) {
  if (matchVersion.onOrAfter(Version.LUCENE_4_7)) {
    this.scanner = new StandardTokenizerImpl(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_4_0)) {
    this.scanner = new StandardTokenizerImpl40(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_3_4)) {
    this.scanner = new StandardTokenizerImpl34(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_3_1)) {
    this.scanner = new StandardTokenizerImpl31(input);
  } else {
    this.scanner = new ClassicTokenizerImpl(input);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:14,代碼來源:StandardTokenizer.java

示例8: getScannerFor

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
private StandardTokenizerInterface getScannerFor(Version matchVersion) {
  // best effort NPE if you dont call reset
  if (matchVersion.onOrAfter(Version.LUCENE_4_7)) {
    return new UAX29URLEmailTokenizerImpl(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_4_0)) {
    return new UAX29URLEmailTokenizerImpl40(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_3_6)) {
    return new UAX29URLEmailTokenizerImpl36(input);
  } else if (matchVersion.onOrAfter(Version.LUCENE_3_4)) {
    return new UAX29URLEmailTokenizerImpl34(input);
  } else {
    return new UAX29URLEmailTokenizerImpl31(input);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:UAX29URLEmailTokenizer.java

示例9: ThaiWordFilter

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #ThaiWordFilter(TokenStream)}
 */
@Deprecated
public ThaiWordFilter(Version matchVersion, TokenStream input) {
  super(matchVersion.onOrAfter(Version.LUCENE_3_1) ?
      input : new LowerCaseFilter(matchVersion, input));
  if (!DBBI_AVAILABLE)
    throw new UnsupportedOperationException("This JRE does not have support for Thai segmentation");
  handlePosIncr = matchVersion.onOrAfter(Version.LUCENE_3_1);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:ThaiWordFilter.java

示例10: FrenchAnalyzer

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #FrenchAnalyzer()}
 */
@Deprecated
public FrenchAnalyzer(Version matchVersion) {
  this(matchVersion,
      matchVersion.onOrAfter(Version.LUCENE_3_1) ? DefaultSetHolder.DEFAULT_STOP_SET
          : DefaultSetHolder.DEFAULT_STOP_SET_30);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:FrenchAnalyzer.java

示例11: TrimFilter

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * Create a new {@link TrimFilter}.
 * @param version       the Lucene match version
 * @param in            the stream to consume
 * @param updateOffsets whether to update offsets
 * @deprecated Offset updates are not supported anymore as of Lucene 4.4.
 */
@Deprecated
public TrimFilter(Version version, TokenStream in, boolean updateOffsets) {
  super(in);
  if (updateOffsets && version.onOrAfter(Version.LUCENE_4_4)) {
    throw new IllegalArgumentException("updateOffsets=true is not supported anymore as of Lucene 4.4");
  }
  this.updateOffsets = updateOffsets;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:16,代碼來源:TrimFilter.java

示例12: WordDelimiterFilter

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #WordDelimiterFilter(TokenStream, byte[], int, CharArraySet)}
 */
@Deprecated
public WordDelimiterFilter(Version matchVersion, TokenStream in, byte[] charTypeTable, int configurationFlags, CharArraySet protWords) {
  super(in);
  if (!matchVersion.onOrAfter(Version.LUCENE_4_8)) {
    throw new IllegalArgumentException("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));
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:15,代碼來源:WordDelimiterFilter.java

示例13: init

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/** Initializes a query parser.  Called by the QueryParser constructor
 *  @param matchVersion  Lucene version to match. See <a href="QueryParser.html#version">here</a>.
 *  @param f  the default field for query terms.
 *  @param a   used to find terms in the query text.
 */
public void init(Version matchVersion, String f, Analyzer a) {
  init(f, a);
  if (matchVersion.onOrAfter(Version.LUCENE_3_1) == false) {
    setAutoGeneratePhraseQueries(true);
  }
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:QueryParserBase.java

示例14: create

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public TokenStream create(TokenStream tokenStream) {
    final Version version = this.version == Version.LUCENE_4_3 ? Version.LUCENE_4_4 : this.version; // we supported it since 4.3
    if (version.onOrAfter(Version.LUCENE_4_3)) {
        return new NGramTokenFilter(tokenStream, minGram, maxGram);
    } else {
        return new Lucene43NGramTokenFilter(tokenStream, minGram, maxGram);
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:11,代碼來源:NGramTokenFilterFactory.java

示例15: ThaiAnalyzer

import org.apache.lucene.util.Version; //導入方法依賴的package包/類
/**
 * @deprecated Use {@link #ThaiAnalyzer()}
 */
@Deprecated
public ThaiAnalyzer(Version matchVersion) {
  this(matchVersion, matchVersion.onOrAfter(Version.LUCENE_3_6) ? DefaultSetHolder.DEFAULT_STOP_SET : StopAnalyzer.ENGLISH_STOP_WORDS_SET);
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:8,代碼來源:ThaiAnalyzer.java


注:本文中的org.apache.lucene.util.Version.onOrAfter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。