Package org.hibernate.search.engine.spi

Examples of org.hibernate.search.engine.spi.EntityIndexBinding


      log.trace( sb.toString() );
    }
    WorkQueuePerIndexSplitter context = new WorkQueuePerIndexSplitter();
    for ( LuceneWork work : sealedQueue ) {
      final Class<?> entityType = work.getEntityClass();
      EntityIndexBinding entityIndexBinding = entityIndexBindings.get( entityType );
      IndexShardingStrategy shardingStrategy = entityIndexBinding.getSelectionStrategy();
      work.getWorkDelegate( TransactionalSelectionVisitor.INSTANCE )
        .performOperation( work, shardingStrategy, context );
    }
    context.commitOperations( null );
  }
View Full Code Here


  private boolean transactionExpected;

  @Override
  public void performWork(Work work, TransactionContext transactionContext) {
    final Class<?> entityType = instanceInitializer.getClassFromWork( work );
    EntityIndexBinding indexBindingForEntity = factory.getIndexBinding( entityType );
    if ( indexBindingForEntity == null
        && factory.getDocumentBuilderContainedEntity( entityType ) == null ) {
      throw new SearchException( "Unable to perform work. Entity Class is not @Indexed nor hosts @ContainedIn: " + entityType );
    }
    work = interceptWork( indexBindingForEntity, work );
View Full Code Here

    }
  }

  @Override
  public void optimize(Class entityType) {
    EntityIndexBinding entityIndexBinding = getSafeIndexBindingForEntity( entityType );
    for ( IndexManager im : entityIndexBinding.getIndexManagers() ) {
      im.optimize();
    }
  }
View Full Code Here

    return analyzer;
  }

  @Override
  public Analyzer getAnalyzer(Class<?> clazz) {
    EntityIndexBinding entityIndexBinding = getSafeIndexBindingForEntity( clazz );
    DocumentBuilderIndexedEntity builder = entityIndexBinding.getDocumentBuilder();
    return builder.getAnalyzer();
  }
View Full Code Here

  public EntityIndexBinding getSafeIndexBindingForEntity(Class<?> entityType) {
    if ( entityType == null ) {
      throw log.nullIsInvalidIndexedType();
    }
    EntityIndexBinding entityIndexBinding = getIndexBinding( entityType );
    if ( entityIndexBinding == null ) {
      throw log.notAnIndexedType( entityType.getName() );
    }
    return entityIndexBinding;
  }
View Full Code Here

    IndexedTypeDescriptor typeDescriptor;
    if ( indexedTypeDescriptors.containsKey( entityType ) ) {
      typeDescriptor = indexedTypeDescriptors.get( entityType );
    }
    else {
      EntityIndexBinding indexBinder = indexBindingForEntities.get( entityType );
      IndexedTypeDescriptor indexedTypeDescriptor;
      if ( indexBinder == null ) {
        indexedTypeDescriptor = new IndexedTypeDescriptorForUnindexedType( entityType );
      }
      else {
        indexedTypeDescriptor = new IndexedTypeDescriptorImpl(
            indexBinder.getDocumentBuilder().getMetadata(),
            indexBinder.getIndexManagers()
        );
      }
      indexedTypeDescriptors.put( entityType, indexedTypeDescriptor );
      typeDescriptor = indexedTypeDescriptor;
    }
View Full Code Here

    }
    return -1;
  }

  private static DocumentBuilderIndexedEntity getDocumentBuilder(SearchFactoryImplementor searchFactoryImplementor, Class<?> clazz) {
    EntityIndexBinding entityIndexBinding = searchFactoryImplementor.getIndexBinding(
        clazz
    );
    if ( entityIndexBinding == null ) {
      throw new SearchException( "No Lucene configuration set up for: " + clazz );
    }
    return entityIndexBinding.getDocumentBuilder();
  }
View Full Code Here

   * @param entityClass the entity type for which to retrieve the document builder
   *
   * @return the DocumentBuilder for this type
   */
  private static AbstractDocumentBuilder getEntityBuilder(SearchFactoryImplementor searchFactoryImplementor, Class<?> entityClass) {
    EntityIndexBinding entityIndexBinding = searchFactoryImplementor.getIndexBinding( entityClass );
    if ( entityIndexBinding == null ) {
      DocumentBuilderContainedEntity entityBuilder = searchFactoryImplementor.getDocumentBuilderContainedEntity(
          entityClass
      );
      if ( entityBuilder == null ) {
        // should never happen but better be safe than sorry
        throw new SearchException(
            "Unable to perform work. Entity Class is not @Indexed nor hosts @ContainedIn: " + entityClass
        );
      }
      else {
        return entityBuilder;
      }
    }
    else {
      return entityIndexBinding.getDocumentBuilder();
    }
  }
View Full Code Here

        }
      }
    }

    private EntityIndexingInterceptor getEntityInterceptor() {
      EntityIndexBinding indexBindingForEntity = searchFactoryImplementor.getIndexBinding(
          entityClass
      );
      return indexBindingForEntity != null ? indexBindingForEntity.getEntityIndexingInterceptor() : null;
    }
View Full Code Here

  private void assertFacetingFieldExists() {
    if ( fieldName == null ) {
      throw new IllegalArgumentException( "null is an invalid field name" );
    }

    EntityIndexBinding indexBinding = factory.getIndexBinding( entityType );
    if ( indexBinding == null ) {
      throw new SearchException(
          "Entity " + entityType.getName()
              + " is not an indexed entity. Unable to create faceting request"
      );
    }
    documentBuilder = indexBinding.getDocumentBuilder();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.search.engine.spi.EntityIndexBinding

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.