alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lucene example source code file (Version.java)

This example Lucene source code file (Version.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lucene tags/keywords

deprecated, deprecated, lucene_20, lucene_21, lucene_21, lucene_22, lucene_22, lucene_23, lucene_29, lucene_30, lucene_31, lucene_32, lucene_32, lucene_33

The Lucene Version.java source code

package org.apache.lucene.util;

/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


/**
 * Use by certain classes to match version compatibility
 * across releases of Lucene.
 * 
 * <p>WARNING: When changing the version parameter
 * that you supply to components in Lucene, do not simply
 * change the version at search-time, but instead also adjust
 * your indexing code to match, and re-index.
 */
// remove me when java 5 is no longer supported
// this is a workaround for a JDK bug that wrongly emits a warning.
@SuppressWarnings("dep-ann")
public enum Version {

  /** Match settings and bugs in Lucene's 2.0 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_20,

  /** Match settings and bugs in Lucene's 2.1 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_21,

  /** Match settings and bugs in Lucene's 2.2 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_22,

  /** Match settings and bugs in Lucene's 2.3 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_23,

  /** Match settings and bugs in Lucene's 2.4 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_24,

  /** Match settings and bugs in Lucene's 2.9 release. 
   * @deprecated (3.1) Use latest 
   */
  @Deprecated
  LUCENE_29,

  /** Match settings and bugs in Lucene's 3.0 release. */
  LUCENE_30,

  /** Match settings and bugs in Lucene's 3.1 release. */
  LUCENE_31,
  
  /** Match settings and bugs in Lucene's 3.2 release. */
  LUCENE_32,
  
  /**
   * Match settings and bugs in Lucene's 3.3 release.
   * <p>
   * Use this to get the latest & greatest settings, bug
   * fixes, etc, for Lucene.
   */
  LUCENE_33,
  
  /* Add new constants for later versions **here** to respect order! */

  /**
   * <p>WARNING: if you use this setting, and then
   * upgrade to a newer release of Lucene, sizable changes
   * may happen.  If backwards compatibility is important
   * then you should instead explicitly specify an actual
   * version.
   * <p>
   * If you use this constant then you  may need to 
   * <b>re-index all of your documents when upgrading
   * Lucene, as the way text is indexed may have changed. 
   * Additionally, you may need to <b>re-test your entire
   * application</b> to ensure it behaves as expected, as 
   * some defaults may have changed and may break functionality 
   * in your application. 
   * @deprecated Use an actual version instead. 
   */
  @Deprecated
  LUCENE_CURRENT;

  public boolean onOrAfter(Version other) {
    return compareTo(other) >= 0;
  }
}

Other Lucene examples (source code examples)

Here is a short list of links related to this Lucene Version.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.