Package org.hibernate.search

Examples of org.hibernate.search.SearchException


    return searcher.doc( docId( index ), selector );
  }

  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


    try {
      writer.deleteDocuments( idTerm );
    }
    catch ( Exception e ) {
      String message = "Unable to remove " + managedType + "#" + id + " from index.";
      throw new SearchException( message, e );
    }
  }
View Full Code Here

    try {
      reader.deleteDocuments( idTerm );
    }
    catch ( Exception e ) {
      String message = "Unable to remove " + managedType + "#" + id + " from index.";
      throw new SearchException( message, e );
    }
  }
View Full Code Here

      writer.setSimilarity( similarity );
      writer.addDocument( work.getDocument(), analyzer );
      workspace.incrementModificationCounter( 1 );
    }
    catch ( IOException e ) {
      throw new SearchException(
          "Unable to add to Lucene index: "
              + work.getEntityClass() + "#" + work.getId(), e
      );
    }
  }
View Full Code Here

    try {
      writer.deleteDocuments( entityDeletionQuery );
    }
    catch ( Exception e ) {
      String message = "Unable to remove " + entityType + "#" + work.getId() + " from index.";
      throw new SearchException( message, e );
    }
  }
View Full Code Here

        }
      }
      //TODO shouldn't this use workspace.incrementModificationCounter( 1 ) ?
    }
    catch ( Exception e ) {
      throw new SearchException(
          "Unable to remove from Lucene index: "
              + entityType + "#" + work.getId(), e
      );
    }
    finally {
View Full Code Here

          }
          else if ( org.hibernate.search.bridge.StringBridge.class.isAssignableFrom( impl ) ) {
            bridge = new String2FieldBridgeAdaptor( (org.hibernate.search.bridge.StringBridge) instance );
          }
          else {
            throw new SearchException(
                "@ClassBridge implementation implements none of the field bridge interfaces: "
                    + impl
            );
          }
          if ( cb.params().length > 0 && ParameterizedBridge.class.isAssignableFrom( impl ) ) {
            Map<String, String> params = new HashMap<String, String>( cb.params().length );
            for ( Parameter param : cb.params() ) {
              params.put( param.name(), param.value() );
            }
            ( (ParameterizedBridge) instance ).setParameterValues( params );
          }
        }
        catch ( Exception e ) {
          final String msg = "Unable to instantiate ClassBridge of type " + impl.getName() + " defined on "
              + clazz.getName();
          throw new HibernateException( msg, e );
        }
      }
    }
    if ( bridge == null ) {
      throw new SearchException( "Unable to guess FieldBridge for " + ClassBridge.class.getName() );
    }

    return bridge;
  }
View Full Code Here

        bridge = new TwoWayString2FieldBridgeAdaptor( enumBridge );
      }
    }
    //TODO add classname
    if ( bridge == null ) {
      throw new SearchException( "Unable to guess FieldBridge for " + member.getName() );
    }
    return bridge;
  }
View Full Code Here

      Class<?> appliedOnType) {
    assert bridgeAnn != null : "@FieldBridge instance cannot be null";
    FieldBridge bridge;
    Class impl = bridgeAnn.impl();
    if ( impl == void.class ) {
      throw new SearchException( "@FieldBridge with no implementation class defined in: " + appliedOnName );
    }
    try {
      Object instance = impl.newInstance();
      if ( FieldBridge.class.isAssignableFrom( impl ) ) {
        bridge = (FieldBridge) instance;
      }
      else if ( TwoWayStringBridge.class.isAssignableFrom( impl ) ) {
        bridge = new TwoWayString2FieldBridgeAdaptor(
            (TwoWayStringBridge) instance
        );
      }
      else if ( org.hibernate.search.bridge.StringBridge.class.isAssignableFrom( impl ) ) {
        bridge = new String2FieldBridgeAdaptor( (org.hibernate.search.bridge.StringBridge) instance );
      }
      else {
        throw new SearchException(
            "@FieldBridge implementation implements none of the field bridge interfaces: "
                + impl + " in " + appliedOnName
        );
      }
      if ( bridgeAnn.params().length > 0 && ParameterizedBridge.class.isAssignableFrom( impl ) ) {
        Map<String, String> params = new HashMap<String, String>( bridgeAnn.params().length );
        for ( Parameter param : bridgeAnn.params() ) {
          params.put( param.name(), param.value() );
        }
        ( (ParameterizedBridge) instance ).setParameterValues( params );
      }
      populateReturnType( appliedOnType, impl, instance );
    }
    catch ( Exception e ) {
      //TODO add classname
      throw new SearchException( "Unable to instantiate FieldBridge for " + appliedOnName, e );
    }
    return bridge;
  }
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

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.