Package org.hibernate.search.exception

Examples of org.hibernate.search.exception.SearchException


    searcher.doc( docId( index ), fieldVisitor );
  }

  public ScoreDoc scoreDoc(int index) throws IOException {
    if ( index >= totalHits ) {
      throw new SearchException( "Not a valid ScoreDoc index: " + index );
    }

    // TODO - Is there a better way to get more TopDocs? Get more or less?
    if ( index >= topDocs.scoreDocs.length ) {
      updateTopDocs( 2 * index );
View Full Code Here


    log.debugf( "Index directory: %s", indexDir.getPath() );
    try {
      indexName = indexDir.getCanonicalPath();
    }
    catch (IOException e) {
      throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
    }
    copyChunkSize = DirectoryProviderHelper.getCopyBufferSize( directoryProviderName, properties );
    current = 0; //publish all state to other threads
  }
View Full Code Here

  }

  private boolean currentMarkerIsInSource() {
    int retry = ConfigurationParseHelper.getIntValue( properties, Environment.RETRY_MARKER_LOOKUP, 0 );
    if ( retry < 0 ) {
      throw new SearchException( Environment.RETRY_MARKER_LOOKUP +
          " option must be a positive integer, but was \"" + retry + "\"" );
    }
    boolean currentMarkerInSource = false;
    for ( int tried = 0 ; tried <= retry ; tried++ ) {
      //we try right away the first time
View Full Code Here

      long period = DirectoryProviderHelper.getRetryInitializePeriod( properties, directoryProviderName );
      if ( period != 0 ) {
        scheduleTask( new InitTask(), period );
      }
      else {
        throw new SearchException( "Failed to initialize DirectoryProvider \""
            + directoryProviderName + "\": could not find marker file in index source" );
      }
    }
  }
View Full Code Here

        }
        else if ( new File( sourceIndexDir, "current2" ).exists() ) {
          sourceCurrent = 2;
        }
        else {
          throw new SearchException( "No current file marker found in source directory: " + sourceIndexDir.getPath() );
        }
        try {
          FileHelper.synchronize(
              new File( sourceIndexDir, String.valueOf( sourceCurrent ) ),
              destinationFile, true, copyChunkSize
          );
        }
        catch (IOException e) {
          throw new SearchException( "Unable to synchronize directory: " + indexName, e );
        }
        if ( !currentMarker.createNewFile() ) {
          throw new SearchException( "Unable to create the directory marker file: " + indexName );
        }
      }
      log.debugf( "Current directory: %d", currentToBe );
    }
    catch (IOException e) {
      throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
    }
    updateTask = new UpdateTask( sourceIndexDir, indexDir );
    long period = DirectoryProviderHelper.getRefreshPeriod( properties, directoryProviderName );
    scheduleTask( updateTask, period );
    this.current = currentToBe;
View Full Code Here

    //there is nobody out there with a non default @Indexed.index
    if ( rootIndex != null ) {
      return rootIndex.getName();
    }
    else {
      throw new SearchException(
          "Trying to extract the index name from a non @Indexed class: " + clazz.getName()
      );
    }
  }
View Full Code Here

    if ( acquired ) {
      try {
        writer.forceMerge( 1, true );
      }
      catch (IOException e) {
        throw new SearchException( "Unable to optimize directoryProvider: " + indexName, e );
      }
      finally {
        optimizerIsBusy.set( false );
      }
      return true;
View Full Code Here

      indexName = indexDir.getCanonicalPath();
      //this is cheap so it's not done in start()
      directory = DirectoryProviderHelper.createFSIndex( indexDir, properties, context.getServiceManager() );
    }
    catch (IOException e) {
      throw new SearchException( "Unable to initialize index: " + directoryProviderName, e );
    }
  }
View Full Code Here

      case NOT_ANALYZED:
        return SerializableIndex.NOT_ANALYZED;
      case NOT_ANALYZED_NO_NORMS:
        return SerializableIndex.NOT_ANALYZED_NO_NORMS;
      default:
        throw new SearchException( "Unable to convert Field.Index value into serializable Index: " + index);
    }
  }
View Full Code Here

    }
    try {
      provider.initialize( directoryProviderName, indexProps, context );
    }
    catch (Exception e) {
      throw new SearchException( "Unable to initialize directory provider: " + directoryProviderName, e );
    }
    return provider;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.exception.SearchException

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.