Examples of SearchException


Examples of org.hibernate.search.SearchException

    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

Examples of org.hibernate.search.SearchException

    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

Examples of org.hibernate.search.SearchException

    }
  }

  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

Examples of org.hibernate.search.SearchException

    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

Examples of org.hibernate.search.SearchException

          log.trace( "Field {} projected as {}", fieldName, result[matchingPosition] );
        }
      }
      else {
        if ( store == Field.Store.NO ) {
          throw new SearchException( "Projecting an unstored field: " + fieldName );
        }
        else {
          throw new SearchException( "FieldBridge is not a TwoWayFieldBridge: " + fieldBridge.getClass() );
        }
      }
    }
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

      try {
        Class processorFactoryClass = ReflectHelper.classForName( backend, BatchedQueueingProcessor.class );
        backendQueueProcessorFactory = ( BackendQueueProcessorFactory ) processorFactoryClass.newInstance();
      }
      catch ( ClassNotFoundException e ) {
        throw new SearchException( "Unable to find processor class: " + backend, e );
      }
      catch ( IllegalAccessException e ) {
        throw new SearchException( "Unable to instanciate processor class: " + backend, e );
      }
      catch ( InstantiationException e ) {
        throw new SearchException( "Unable to instanciate processor class: " + backend, e );
      }
    }
    backendQueueProcessorFactory.initialize( properties, searchFactoryImplementor );
    searchFactoryImplementor.setBackendQueueProcessorFactory( backendQueueProcessorFactory );
  }
View Full Code Here

Examples of org.hibernate.search.SearchException

      loader.setEntityTypes( classes );
      return loader;
    }
    if ( criteria != null ) {
      if ( classes.length > 1 ) {
        throw new SearchException( "Cannot mix criteria and multiple entity types" );
      }
      if ( criteria instanceof CriteriaImpl ) {
        String targetEntity = ( ( CriteriaImpl ) criteria ).getEntityOrClassName();
        if ( classes.length == 1 && !classes[0].getName().equals( targetEntity ) ) {
          throw new SearchException( "Criteria query entity should match query entity" );
        }
        else {
          try {
            Class entityType = ReflectHelper.classForName( targetEntity );
            classes = new Class[] { entityType };
          }
          catch ( ClassNotFoundException e ) {
            throw new SearchException( "Unable to load entity class from criteria: " + targetEntity, e );
          }
        }
      }
      QueryLoader loader = new QueryLoader();
      loader.init( session, searchFactoryImplementor );
View Full Code Here

Examples of org.hibernate.search.SearchException

  public Explanation explain(int documentId) {
    Explanation explanation = null;
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    Searcher searcher = buildSearcher( searchFactoryImplementor );
    if ( searcher == null ) {
      throw new SearchException(
          "Unable to build explanation for document id:"
              + documentId + ". no index found"
      );
    }
    try {
View Full Code Here

Examples of org.hibernate.search.SearchException

    if ( def.getFactoryMethod() != null ) {
      try {
        filter = ( Filter ) def.getFactoryMethod().invoke( instance );
      }
      catch ( IllegalAccessException e ) {
        throw new SearchException(
            "Unable to access @Factory method: "
                + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
        );
      }
      catch ( InvocationTargetException e ) {
        throw new SearchException(
            "Unable to access @Factory method: "
                + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
        );
      }
      catch ( ClassCastException e ) {
        throw new SearchException(
            "@Key method does not return a org.apache.lucene.search.Filter class: "
                + def.getImpl().getName() + "." + def.getFactoryMethod().getName()
        );
      }
    }
    else {
      try {
        filter = ( Filter ) instance;
      }
      catch ( ClassCastException e ) {
        throw new SearchException(
            "Filter implementation does not implement the Filter interface: "
                + def.getImpl().getName() + ". "
                + ( def.getFactoryMethod() != null ? def.getFactoryMethod().getName() : "" ), e
        );
      }
View Full Code Here

Examples of org.hibernate.search.SearchException

    else {
      try {
        key = ( FilterKey ) def.getKeyMethod().invoke( instance );
      }
      catch ( IllegalAccessException e ) {
        throw new SearchException(
            "Unable to access @Key method: "
                + def.getImpl().getName() + "." + def.getKeyMethod().getName()
        );
      }
      catch ( InvocationTargetException e ) {
        throw new SearchException(
            "Unable to access @Key method: "
                + def.getImpl().getName() + "." + def.getKeyMethod().getName()
        );
      }
      catch ( ClassCastException e ) {
        throw new SearchException(
            "@Key method does not return FilterKey: "
                + def.getImpl().getName() + "." + def.getKeyMethod().getName()
        );
      }
    }
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.