Package org.apache.lucene.util

Examples of org.apache.lucene.util.Version


    runData.setIndexWriter(configureWriter(config, runData, OpenMode.CREATE, null));
    return 1;
  }
 
  public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {
    Version version = Version.valueOf(config.get("writer.version", Version.LUCENE_40.toString()));
    IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.getAnalyzer());
    iwConf.setOpenMode(mode);
    IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
    iwConf.setIndexDeletionPolicy(indexDeletionPolicy);
    if(commit != null)
View Full Code Here


   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

    }

    public Builder(Class<?> indexedType, ConfigContext configContext, ScopedAnalyzer scopedAnalyzer) {
      this.indexedType = indexedType;
      this.scopedAnalyzer = scopedAnalyzer;
      Version luceneVersion = configContext.getLuceneMatchVersion();
      this.passThroughAnalyzer = new PassThroughAnalyzer( luceneVersion );
    }
View Full Code Here

      return false;
    }
  }

  private Version getLuceneMatchVersion(SearchConfiguration cfg) {
    Version version;
    String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION );
    if ( StringHelper.isEmpty( tmp ) ) {
      log.recommendConfiguringLuceneVersion();
      version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
      try {
        version = Version.valueOf( tmp );
        if ( log.isDebugEnabled() ) {
          log.debug( "Setting Lucene compatibility to Version " + version.name() );
        }
      }
      catch (IllegalArgumentException e) {
        StringBuilder msg = new StringBuilder( tmp );
        msg.append( " is a invalid value for the Lucene match version. Possible values are: " );
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version =  Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

      return false;
    }
  }

  private Version getLuceneMatchVersion(SearchConfiguration cfg) {
    Version version;
    String tmp = cfg.getProperty( Environment.LUCENE_MATCH_VERSION );
    if ( StringHelper.isEmpty( tmp ) ) {
      log.recommendConfiguringLuceneVersion();
      version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    }
    else {
      try {
        version = Version.valueOf( tmp );
        if ( log.isDebugEnabled() ) {
          log.debug( "Setting Lucene compatibility to Version " + version.name() );
        }
      }
      catch ( IllegalArgumentException e ) {
        StringBuilder msg = new StringBuilder( tmp );
        msg.append( " is a invalid value for the Lucene match version. Possible values are: " );
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version =  Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! IndexReader.indexExists( directory ) ) {
        IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
        IndexWriter iw = new IndexWriter( directory, iwriterConfig );
View Full Code Here

    return 1;
  }
 
  public static IndexWriterConfig createWriterConfig(Config config, PerfRunData runData, OpenMode mode, IndexCommit commit) {
    // :Post-Release-Update-Version.LUCENE_XY:
    Version version = Version.valueOf(config.get("writer.version", Version.LUCENE_47.toString()));
    IndexWriterConfig iwConf = new IndexWriterConfig(version, runData.getAnalyzer());
    iwConf.setOpenMode(mode);
    IndexDeletionPolicy indexDeletionPolicy = getIndexDeletionPolicy(config);
    iwConf.setIndexDeletionPolicy(indexDeletionPolicy);
    if(commit != null)
View Full Code Here

    }

    public Builder(Class<?> indexedType, ConfigContext configContext, ScopedAnalyzer scopedAnalyzer) {
      this.indexedType = indexedType;
      this.scopedAnalyzer = scopedAnalyzer;
      Version luceneVersion = configContext.getLuceneMatchVersion();
      this.passThroughAnalyzer = new PassThroughAnalyzer( luceneVersion );
    }
View Full Code Here

   * @param directory the Directory to initialize
   * @throws SearchException in case of lock acquisition timeouts, IOException, or if a corrupt index is found
   */
  public static void initializeIndexIfNeeded(Directory directory) {
    //version doesn't really matter as we won't use the Analyzer
    Version version = Environment.DEFAULT_LUCENE_MATCH_VERSION;
    SimpleAnalyzer analyzer = new SimpleAnalyzer( version );
    try {
      if ( ! DirectoryReader.indexExists( directory ) ) {
        try {
          IndexWriterConfig iwriterConfig = new IndexWriterConfig( version, analyzer ).setOpenMode( OpenMode.CREATE );
View Full Code Here

TOP

Related Classes of org.apache.lucene.util.Version

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.