Example usage for org.apache.lucene.util Version onOrAfter

List of usage examples for org.apache.lucene.util Version onOrAfter

Introduction

In this page you can find the example usage for org.apache.lucene.util Version onOrAfter.

Prototype

public boolean onOrAfter(Version other) 

Source Link

Document

Returns true if this version is the same or after the version from the argument.

Usage

From source file:analysis.StandardAnalyzer.java

License:Apache License

/** Builds an analyzer with the given stop words.
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopWords stop words */
public StandardAnalyzer(Version matchVersion, Set<?> stopWords) {
    stopSet = stopWords;/*from w  ww .j a  v a  2  s  . co m*/
    setOverridesTokenStreamMethod(StandardAnalyzer.class);
    enableStopPositionIncrements = StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion);
    replaceInvalidAcronym = matchVersion.onOrAfter(Version.LUCENE_24);
    this.matchVersion = matchVersion;
}

From source file:ca.ubc.cs.reverb.indexer.ReverbLuceneAnalyzer.java

License:Apache License

/** Builds an analyzer with the given stop words.
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopWords stop words */
public ReverbLuceneAnalyzer(Version matchVersion, Set<?> stopWords) {
    super(matchVersion, stopWords);
    replaceInvalidAcronym = matchVersion.onOrAfter(Version.LUCENE_24);
}

From source file:ca.ubc.cs.reverb.indexer.WebPageAnalyzer.java

License:Apache License

/** Builds an analyzer with the given stop words.
 * @param matchVersion Lucene version to match See {@link
 * <a href="#version">above</a>}
 * @param stopWords stop words */
public WebPageAnalyzer(Version matchVersion, Set<?> stopWords) {
    super(matchVersion, stopWords);
    replaceInvalidAcronym = matchVersion.onOrAfter(Version.LUCENE_24);
}

From source file:cc.explain.lucene.StandardAnalyzerWithoutLowerCase.java

License:Apache License

/**
 * Builds an analyzer with the given stop words.
 *
 * @param matchVersion Lucene version to match See {@link
 *                     <a href="#version">above</a>}
 * @param stopWords    stop words/*from  w ww  . j  a v  a 2  s. c  o  m*/
 */
public StandardAnalyzerWithoutLowerCase(Version matchVersion, Set<?> stopWords) {
    stopSet = stopWords;
    setOverridesTokenStreamMethod(StandardAnalyzerWithoutLowerCase.class);
    enableStopPositionIncrements = StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion);
    replaceInvalidAcronym = matchVersion.onOrAfter(Version.LUCENE_24);
    this.matchVersion = matchVersion;
}

From source file:com.doculibre.analyzer.FrenchAccentPlurielAnalyzer.java

License:Apache License

/**
 * Builds an analyzer with the default stop words ({@link #getDefaultStopSet}).
 *///from   w w  w .  ja  v  a2  s .  c  o  m
public FrenchAccentPlurielAnalyzer(Version matchVersion) {
    this(matchVersion, matchVersion.onOrAfter(Version.LUCENE_31) ? DefaultSetHolder.DEFAULT_STOP_SET
            : DefaultSetHolder.DEFAULT_STOP_SET_30);
}

From source file:com.github.le11.nls.lucene.TypeAwareStopFilter.java

License:Apache License

/**
 * Construct a token stream filtering the given input. If
 * <code>stopWords</code> is an instance of {@link org.apache.lucene.analysis.CharArraySet} (true if
 * <code>makeStopSet()</code> was used to construct the set) it will be
 * directly used and <code>ignoreCase</code> will be ignored since
 * <code>CharArraySet</code> directly controls case sensitivity.
 * <p/>/*from  w w w  .  j  a  v a 2 s.c o  m*/
 * If <code>stopWords</code> is not an instance of {@link org.apache.lucene.analysis.CharArraySet}, a new
 * CharArraySet will be constructed and <code>ignoreCase</code> will be used
 * to specify the case sensitivity of that set.
 *
 * @param matchVersion Lucene version to enable correct Unicode 4.0 behavior in the stop
 *                     set if Version > 3.0. See <a href="#version">above</a> for details.
 * @param input        Input TokenStream
 * @param stopWords    A Set of Strings or char[] or any other toString()-able set
 *                     representing the stopwords
 * @param ignoreCase   if true, all words are lower cased first
 */
public TypeAwareStopFilter(Version matchVersion, TokenStream input, Set<?> stopWords, boolean ignoreCase) {
    this(matchVersion, matchVersion.onOrAfter(Version.LUCENE_34), input, stopWords, ignoreCase);
}

From source file:com.github.le11.nls.lucene.TypeAwareStopFilter.java

License:Apache License

public TypeAwareStopFilter(Version matchVersion, TokenStream input, Set<?> stopWords, boolean ignoreCase,
        List<String> blockedTypes) {
    this(matchVersion, matchVersion.onOrAfter(Version.LUCENE_34), input, stopWords, ignoreCase);
    this.blockedTypes = blockedTypes;
    Collections.sort(this.blockedTypes);
}

From source file:com.github.le11.nls.lucene.TypeAwareStopFilter.java

License:Apache License

/**
 * Returns version-dependent default for
 * enablePositionIncrements.  Analyzers that embed
 * StopFilter use this method when creating the
 * StopFilter.  Prior to 2.9, this returns false.  On 2.9
 * or later, it returns true./*from ww w.  ja v  a  2s . c  o m*/
 *
 * @deprecated use {@link #TypeAwareStopFilter(org.apache.lucene.util.Version, org.apache.lucene.analysis.TokenStream, java.util.Set)} instead
 */
@Deprecated
public static boolean getEnablePositionIncrementsVersionDefault(Version matchVersion) {
    return matchVersion.onOrAfter(Version.LUCENE_29);
}

From source file:com.sindicetech.siren.solr.schema.AnalyzerConfigReader.java

License:Open Source License

private static Version parseConfiguredVersion(final String configuredVersion, final String pluginClassName,
        final Version luceneMatchVersion) {
    final Version version = (configuredVersion != null) ? Config.parseLuceneVersionString(configuredVersion)
            : luceneMatchVersion;//from ww  w.j  a v  a  2 s.  c o  m

    if (!version.onOrAfter(Version.LUCENE_40)) {
        logger.warn(pluginClassName + " is using deprecated " + version
                + " emulation. You should at some point declare and reindex to at least 4.0, because "
                + "3.x emulation is deprecated and will be removed in 5.0");
    }

    return version;
}

From source file:ddf.catalog.pubsub.criteria.contextual.CaseSensitiveContextualAnalyzer.java

License:Open Source License

/**
 * Builds an analyzer with the given stop words.
 *
 * @param matchVersion/*ww w. j a  va 2  s. com*/
 *            Lucene version to match See {@link <a href="#version">above</a>}
 * @param stopWords
 *            stop words
 */
public CaseSensitiveContextualAnalyzer(Version matchVersion, Set<?> stopWords) {
    stopSet = stopWords;
    setOverridesTokenStreamMethod(CaseSensitiveContextualAnalyzer.class);
    enableStopPositionIncrements = StopFilter.getEnablePositionIncrementsVersionDefault(matchVersion);
    replaceInvalidAcronym = matchVersion.onOrAfter(Version.LUCENE_24);
    this.matchVersion = matchVersion;
}