Package org.hibernate.search

Examples of org.hibernate.search.SearchException


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


        Class<? extends Annotation> jpaIdClass =
            ClassLoaderHelper.classForName( "javax.persistence.Id", ConfigContext.class.getClassLoader() );
        jpaId = member.getAnnotation( jpaIdClass );
      }
      catch ( ClassNotFoundException e ) {
        throw new SearchException( "Unable to load @Id.class even though it should be present ?!" );
      }
      if ( jpaId != null ) {
        jpaIdAnnotatedMember = member;
        if ( documentIdAnn == null ) {
          log.debug( "Found JPA id and using it as document id" );
View Full Code Here

          return objectToString( (StringBridge) bridge, fieldName, value, conversionContext );
        }
        throw log.fieldBridgeNotTwoWay( bridgeClass, fieldName, getBeanXClass() );
      }
    }
    throw new SearchException( "Unable to find field " + fieldName + " in " + getBeanXClass() );
  }
View Full Code Here

  private void checkForAnalyzerDiscriminator(XAnnotatedElement annotatedElement, PropertiesMetadata propertiesMetadata, ConfigContext context) {
    AnalyzerDiscriminator discriminatorAnn = annotatedElement.getAnnotation( AnalyzerDiscriminator.class );
    if ( discriminatorAnn != null ) {
      if ( propertiesMetadata.discriminator != null ) {
        throw new SearchException(
            "Multiple AnalyzerDiscriminator defined in the same class hierarchy: " + beanXClass.getName()
        );
      }

      if ( annotatedElement instanceof XProperty && isPropertyTransient( (XProperty)annotatedElement, context ) ) {
        //if the discriminator is calculated on a @Transient field, we can't trust field level dirtyness
        forceStateInspectionOptimizationsDisabled();
      }

      Class<? extends Discriminator> discriminatorClass = discriminatorAnn.impl();
      try {
        propertiesMetadata.discriminator = discriminatorClass.newInstance();
      }
      catch ( Exception e ) {
        throw new SearchException(
            "Unable to instantiate analyzer discriminator implementation: " + discriminatorClass.getName()
        );
      }

      if ( annotatedElement instanceof XMember ) {
View Full Code Here

  private void checkForSimilarity(XClass currClass) {
    org.hibernate.search.annotations.Similarity similarityAnn = currClass.getAnnotation( org.hibernate.search.annotations.Similarity.class );
    if ( similarityAnn != null ) {
      if ( similarity != null ) {
        throw new SearchException(
            "Multiple similarities defined in the same class hierarchy or on the index settings: " + beanXClass
                .getName()
        );
      }
      Class<?> similarityClass = similarityAnn.impl();
View Full Code Here

      if ( isFieldInPath( fieldAnn, member, pathsContext, prefix ) || level <= maxLevel ) {
        bindFieldAnnotation( classHostingMember, member, propertiesMetadata, prefix, fieldAnn, numericFieldAnn, context );
      }
    }
    if ( ( fieldAnn == null && idAnn == null ) && numericFieldAnn != null ) {
      throw new SearchException( "@NumericField without a @Field on property '" + member.getName() + "'" );
    }
  }
View Full Code Here

        Class<? extends Annotation> jpaIdClass =
            ClassLoaderHelper.classForName( "javax.persistence.Transient", ConfigContext.class.getClassLoader() );
        transientAnnotation = member.getAnnotation( jpaIdClass );
      }
      catch ( ClassNotFoundException e ) {
        throw new SearchException( "Unable to load @Transient.class even though it should be present ?!" );
      }
      return transientAnnotation != null;
    }
  }
View Full Code Here

        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 " + beanXClass.getName()
                + "#" + buildEmbeddedPrefix( prefix, embeddedAnn, member )
        );
View Full Code Here

      for ( String path : unencounteredPaths ) {
        sb.append( removeLeadingPrefixFromPath( path, prefix ) );
        sb.append( ',' );
      }
      String message = sb.substring( 0, sb.length() - 1 );
      throw new SearchException( message );
    }
  }
View Full Code Here

    BoostStrategy strategy;
    try {
      strategy = boostStrategyClass.newInstance();
    }
    catch ( Exception e ) {
      throw new SearchException(
          "Unable to instantiate boost strategy implementation: " + boostStrategyClass.getName()
      );
    }
    return strategy;
  }
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.