Examples of SearchException


Examples of org.hibernate.search.SearchException

    if ( reader instanceof MultiReader ) {
      try {
        readers = (IndexReader[]) subReadersField.get( reader );
      }
      catch (IllegalAccessException e) {
        throw new SearchException( "Incompatible version of Lucene: MultiReader.subReaders not accessible", e );
      }
      if ( trace ) log.trace( "Closing MultiReader: " + reader );
    }
    else {
      throw new AssertionFailure( "Everything should be wrapped in a MultiReader" );
View Full Code Here

Examples of org.hibernate.search.SearchException

      try {
        subReadersField = MultiReader.class.getDeclaredField( "subReaders" );
        if ( !subReadersField.isAccessible() ) subReadersField.setAccessible( true );
      }
      catch (NoSuchFieldException e) {
        throw new SearchException( "Incompatible version of Lucene: MultiReader.subReaders not accessible", e );
      }
    }
    Set<DirectoryProvider> providers = searchFactoryImplementor.getLockableDirectoryProviders().keySet();
    perDirectoryProviderManipulationLocks = new HashMap<DirectoryProvider, Lock>( providers.size() );
    for (DirectoryProvider dp : providers) {
View Full Code Here

Examples of org.hibernate.search.SearchException

      try {
        Class shardigStrategyClass = ReflectHelper.classForName( shardingStrategyName, this.getClass() );
        shardingStrategy = (IndexShardingStrategy) shardigStrategyClass.newInstance();
      }
      catch (ClassNotFoundException e) {
        throw new SearchException("Unable to find ShardingStrategy class " + shardingStrategyName + " for " + directoryProviderName, e);
      }
      catch (IllegalAccessException e) {
        throw new SearchException("Unable to create instance of ShardingStrategy class " + shardingStrategyName
            + " Be sure to have a no-arg constructor", e);
      }
      catch (InstantiationException e) {
        throw new SearchException("Unable to create instance of ShardingStrategy class " + shardingStrategyName
            + " Be sure to have a no-arg constructor", e);
      }
      catch (ClassCastException e) {
        throw new SearchException("ShardingStrategy class does not implements DirecotryProviderShardingStrategy: "
            + shardingStrategyName, e);
      }
    }
    shardingStrategy.initialize( shardingProperties, providers );
View Full Code Here

Examples of org.hibernate.search.SearchException

    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setTransactionMergeFactor(Integer.valueOf(s));
        indexingParams.setBatchMergeFactor(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + TRANSACTION + MERGE_FACTOR + ": " + s);
      }
    }

    s = indexProps.getProperty(TRANSACTION + MAX_MERGE_DOCS);
    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setTransactionMaxMergeDocs(Integer.valueOf(s));
        indexingParams.setBatchMaxMergeDocs(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + TRANSACTION + MAX_MERGE_DOCS + ": " + s);
      }
    }
   
    s = indexProps.getProperty(TRANSACTION + MAX_BUFFERED_DOCS);
    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setTransactionMaxBufferedDocs(Integer.valueOf(s));
        indexingParams.setBatchMaxBufferedDocs(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + TRANSACTION + MAX_BUFFERED_DOCS + ": " + s);
      }
    }   
       
    s = indexProps.getProperty(BATCH + MERGE_FACTOR);
    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setBatchMergeFactor(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + BATCH + MERGE_FACTOR + ": " + s);
      }
    }
   
    s = indexProps.getProperty(BATCH + MAX_MERGE_DOCS);
    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setBatchMaxMergeDocs(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + BATCH + MAX_MERGE_DOCS + ": " + s);
      }
    }
   
    s = indexProps.getProperty(BATCH + MAX_BUFFERED_DOCS);
    if (!StringHelper.isEmpty( s )) {
      try{
        indexingParams.setBatchMaxBufferedDocs(Integer.valueOf(s));
      } catch (NumberFormatException ne) {
        throw new SearchException("Invalid value for " + BATCH + MAX_BUFFERED_DOCS + ": " + s);
      }
    } 
    searchFactoryImplementor.addIndexingParmeters(provider, indexingParams);
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

    if ( nbrOfShardsString != null ) {
      try {
        nbrOfShards = Integer.parseInt( nbrOfShardsString );
      }
      catch (NumberFormatException e) {
        throw new SearchException(indexName + "." + NBR_OF_SHARDS + " is not a number", e);
      }
    }
    if ( nbrOfShards <= 0 && indexSpecificProps.size() == 0 ) {
      //no shard (a shareded subindex has to have at least one property
      return new Properties[] { indexSpecificDefaultProps };
View Full Code Here

Examples of org.hibernate.search.SearchException

  }

  private static String defineIndexingStrategy(SearchConfiguration cfg) {
    String indexingStrategy = cfg.getProperties().getProperty( Environment.INDEXING_STRATEGY, "event" );
    if ( ! ("event".equals( indexingStrategy ) || "manual".equals( indexingStrategy ) ) ) {
      throw new SearchException( Environment.INDEXING_STRATEGY + " unknown: " + indexingStrategy );
    }
    return indexingStrategy;
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

    }
  }

  private void bindFilterDef(FullTextFilterDef defAnn, XClass mappedXClass) {
    if ( filterDefinitions.containsKey( defAnn.name() ) ) {
      throw new SearchException("Multiple definition of @FullTextFilterDef.name=" + defAnn.name() + ": "
          + mappedXClass.getName() );
    }

    FilterDef filterDef = new FilterDef(defAnn);
    try {
      filterDef.getImpl().newInstance();
    }
    catch (IllegalAccessException e) {
      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
    }
    catch (InstantiationException e) {
      throw new SearchException("Unable to create Filter class: " + filterDef.getImpl().getName(), e);
    }
    for ( Method method : filterDef.getImpl().getMethods() ) {
      if ( method.isAnnotationPresent( Factory.class ) ) {
        if ( filterDef.getFactoryMethod() != null ) {
          throw new SearchException("Multiple @Factory methods found" + defAnn.name() + ": "
              + filterDef.getImpl().getName() + "." + method.getName() );
        }
        if ( !method.isAccessible() ) method.setAccessible( true );
        filterDef.setFactoryMethod( method );
      }
      if ( method.isAnnotationPresent( Key.class ) ) {
        if ( filterDef.getKeyMethod() != null ) {
          throw new SearchException("Multiple @Key methods found" + defAnn.name() + ": "
              + filterDef.getImpl().getName() + "." + method.getName() );
        }
        if ( !method.isAccessible() ) method.setAccessible( true );
        filterDef.setKeyMethod( method );
      }
View Full Code Here

Examples of org.hibernate.search.SearchException

  }

  public void optimize(Class entityType) {
    if (barrier != 0) {} //read barrier
    if ( ! getDocumentBuilders().containsKey( entityType ) ) {
      throw new SearchException("Entity not indexed: " + entityType);
    }
    List<LuceneWork> queue = new ArrayList<LuceneWork>(1);
    queue.add( new OptimizeLuceneWork( entityType ) );
    getBackendQueueProcessorFactory().getProcessor( queue ).run();
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

  }

  public Analyzer getAnalyzer(String name) {
    if (barrier != 0) {} //read barrier
    final Analyzer analyzer = analyzers.get( name );
    if ( analyzer == null) throw new SearchException( "Unknown Analyzer definition: " + name);
    return analyzer;
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

      try {
        Class filterCachingStrategyClass = org.hibernate.annotations.common.util.ReflectHelper.classForName( impl, SearchFactoryImpl.class );
        filterCachingStrategy = (FilterCachingStrategy) filterCachingStrategyClass.newInstance();
      }
      catch (ClassNotFoundException e) {
        throw new SearchException( "Unable to find filterCachingStrategy class: " + impl, e );
      }
      catch (IllegalAccessException e) {
        throw new SearchException( "Unable to instantiate filterCachingStrategy class: " + impl, e );
      }
      catch (InstantiationException e) {
        throw new SearchException( "Unable to instantiate filterCachingStrategy class: " + impl, e );
      }
    }
    filterCachingStrategy.initialize( properties );
    return filterCachingStrategy;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.