Package org.hibernate.search

Examples of org.hibernate.search.SearchException


      try {
        toClose.close();
        log.trace( "IndexWriter closed" );
      }
      catch ( IOException e ) {
        throw new SearchException( "Exception while closing IndexWriter", e );
      }
    }
    else {
      throw new AssertionFailure( "No open IndexWriter to close" );
    }
View Full Code Here


    //processedClasses.remove( clazz ); for the sake of completness
    this.analyzer.setGlobalAnalyzer( rootPropertiesMetadata.analyzer );
    if ( entityState == EntityState.INDEXED && idKeywordName == null ) {
      // if no DocumentId then check if we have a ProvidedId instead
      ProvidedId provided = findProvidedId( clazz, reflectionManager );
      if ( provided == null ) throw new SearchException( "No document id in: " + clazz.getName() );

      idBridge = BridgeFactory.extractTwoWayType( provided.bridge() );
      idKeywordName = provided.name();
    }
View Full Code Here

    else {
      try {
        return (Analyzer) analyzerClass.newInstance();
      }
      catch (ClassCastException e) {
        throw new SearchException(
            "Lucene analyzer does not implement " + Analyzer.class.getName() + ": " + analyzerClass.getName(), e
        );
      }
      catch (Exception e) {
        throw new SearchException( "Failed to instantiate lucene analyzer with type " + analyzerClass.getName(), e );
      }
    }
  }
View Full Code Here

      //TODO: similarity form @IndexedEmbedded are not taken care of. Exception??
      if ( isRoot ) {
        org.hibernate.search.annotations.Similarity similarityAnn = currClass.getAnnotation( org.hibernate.search.annotations.Similarity.class );
        if ( similarityAnn != null ) {
          if ( similarityClass != null ) {
            throw new SearchException( "Multiple Similarities defined in the same class hierarchy: " + beanClass.getName() );
          }
          similarityClass = similarityAnn.impl();
        }
      }
View Full Code Here

      else {
        elementClass = reflectionManager.toXClass( embeddedAnn.targetElement() );
      }
      if ( maxLevel == Integer.MAX_VALUE //infinite
          && processedClasses.contains( elementClass ) ) {
        throw new SearchException(
            "Circular reference. Duplicate use of "
                + elementClass.getName()
                + " in root entity " + beanClass.getName()
                + "#" + buildEmbeddedPrefix( prefix, embeddedAnn, member )
        );
View Full Code Here

        FieldBridge fieldBridge = BridgeFactory.guessType( null, member, reflectionManager );
        if ( fieldBridge instanceof TwoWayFieldBridge ) {
          idBridge = (TwoWayFieldBridge) fieldBridge;
        }
        else {
          throw new SearchException(
              "Bridge for document id does not implement TwoWayFieldBridge: " + member.getName() );
        }
        idBoost = getBoost( member, null );
        setAccessible( member );
        idGetter = member;
View Full Code Here

    if ( !explicitDocumentId && context.isJpaPresent() ) {
      Class idClass;
      try {
        idClass = org.hibernate.util.ReflectHelper.classForName( "javax.persistence.Id", InitContext.class );
      } catch ( ClassNotFoundException e ) {
        throw new SearchException( "Unable to load @Id.class even though it should be present ?!" );
      }
      documentIdAnn = member.getAnnotation( idClass );
      if ( documentIdAnn != null )
          log.debug( "Found JPA id and using it as document id" );
    }
View Full Code Here

    String className = document.get( DocumentBuilder.CLASS_FIELDNAME );
    try {
      return ReflectHelper.classForName( className );
    }
    catch (ClassNotFoundException e) {
      throw new SearchException( "Unable to load indexed class: " + className, e );
    }
  }
View Full Code Here

    }
  }

  public static Serializable getDocumentId(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document) {
    DocumentBuilder<?> builder = searchFactoryImplementor.getDocumentBuilder( clazz );
    if ( builder == null ) throw new SearchException( "No Lucene configuration set up for: " + clazz.getName() );
    return (Serializable) builder.getIdBridge().get( builder.getIdKeywordName(), document );
  }
View Full Code Here

    return (Serializable) builder.getIdBridge().get( builder.getIdKeywordName(), document );
  }

  public static Object[] getDocumentFields(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz, Document document, String[] fields) {
    DocumentBuilder<?> builder = searchFactoryImplementor.getDocumentBuilder( clazz );
    if ( builder == null ) throw new SearchException( "No Lucene configuration set up for: " + clazz.getName() );
    final int fieldNbr = fields.length;
    Object[] result = new Object[fieldNbr];

    if ( builder.idKeywordName != null ) {
      populateResult( builder.idKeywordName, builder.idBridge, Field.Store.YES, fields, result, document );
View Full Code Here

TOP

Related Classes of org.hibernate.search.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.