Examples of EntityIndexBinding


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

   }

   @Test(dependsOnMethods="simpleIndexTest") //depends as otherwise the Person index is not initialized yet
   public void testPropertiesWhereRead() {
      SearchFactoryIntegrator searchFactory = TestQueryHelperFactory.extractSearchFactory(cache);
      EntityIndexBinding indexBindingForEntity = searchFactory.getIndexBinding(Person.class);
      IndexManager[] managers = indexBindingForEntity.getIndexManagers();
      assertEquals(1, managers.length);
      assertNotNull(managers[0]);
      assertTrue(managers[0] instanceof DirectoryBasedIndexManager);
      DirectoryBasedIndexManager dbim = (DirectoryBasedIndexManager) managers[0];
      assertTrue(dbim.getDirectoryProvider() instanceof RAMDirectoryProvider);
View Full Code Here

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

         worker.performWork(work, transactionContext);
      }
   }

   private boolean isIndexed(final Class<?> c) {
      final EntityIndexBinding indexBinding = this.searchFactory.getIndexBinding(c);
      return indexBinding != null;
   }
View Full Code Here

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

  @SuppressWarnings("unchecked")
  private void index(Object entity, Session session, InstanceInitializer sessionInitializer, ConversionContext conversionContext)
      throws InterruptedException {
    Serializable id = session.getIdentifier( entity );
    Class<?> clazz = HibernateHelper.getClass( entity );
    EntityIndexBinding entityIndexBinding = entityIndexBinders.get( clazz );
    if ( entityIndexBinding == null ) {
      // it might be possible to receive not-indexes subclasses of the currently indexed type;
      // being not-indexed, we skip them.
      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }

    EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor();
    if ( interceptor != null ) {
      IndexingOverride onAdd = interceptor.onAdd( entity );
      switch ( onAdd ) {
        case REMOVE:
        case SKIP:
          return;
      }
      //default: continue indexing this instance
    }

    DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder();
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    conversionContext.pushProperty( docBuilder.getIdKeywordName() );
    String idInString = null;
    try {
      idInString = conversionContext
View Full Code Here

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

      return new EmbeddedLuceneQuery(searchManager, parsingResult, sort, startOffset, maxResults);
   }

   private PropertyMetadata getPropertyMetadata(Class<?> type, String propName) {
      EntityIndexBinding entityIndexBinding = ((SearchFactoryImplementor) searchManager.getSearchFactory()).getIndexBinding(type);
      if (entityIndexBinding == null) {
         throw new IllegalArgumentException("The type " + type.getName() + " is not an indexed entity.");
      }

      return entityIndexBinding.getDocumentBuilder().getMetadata().getPropertyMetadataForProperty(propName);
   }
View Full Code Here

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

         worker.performWork(work, transactionContext);
      }
   }

   private boolean isIndexed(final Class<?> c) {
      final EntityIndexBinding indexBinding = this.searchFactory.getIndexBinding(c);
      return indexBinding != null;
   }
View Full Code Here

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

  @SuppressWarnings("unchecked")
  private void index(Object entity, Session session, InstanceInitializer sessionInitializer, ConversionContext conversionContext)
      throws InterruptedException {
    Serializable id = session.getIdentifier( entity );
    Class<?> clazz = HibernateHelper.getClass( entity );
    EntityIndexBinding entityIndexBinding = entityIndexBinders.get( clazz );
    if ( entityIndexBinding == null ) {
      // it might be possible to receive not-indexes subclasses of the currently indexed type;
      // being not-indexed, we skip them.
      // FIXME for improved performance: avoid loading them in an early phase.
      return;
    }

    EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor();
    if ( interceptor != null ) {
      IndexingOverride onAdd = interceptor.onAdd( entity );
      switch ( onAdd ) {
        case REMOVE:
        case SKIP:
          return;
      }
      //default: continue indexing this instance
    }

    DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder();
    TwoWayFieldBridge idBridge = docBuilder.getIdBridge();
    conversionContext.pushProperty( docBuilder.getIdKeywordName() );
    String idInString = null;
    try {
      idInString = conversionContext
View Full Code Here

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

  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

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

    return tmpMap;
  }

  @Override
  public EntityIndexBinder getIndexBindingForEntity(Class<?> entityType) {
    final EntityIndexBinding entityIndexBinding = indexBindingForEntities.get( entityType );
    if ( entityIndexBinding == null ) {
      return null;
    }
    else {
      return new EntityIndexBindingWrapper( entityIndexBinding );
View Full Code Here

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

    }
  }

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

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

    return analyzer;
  }

  @Override
  public Analyzer getAnalyzer(Class<?> clazz) {
    EntityIndexBinding entityIndexBinding = getSafeIndexBindingForEntity( clazz );
    DocumentBuilderIndexedEntity<?> builder = entityIndexBinding.getDocumentBuilder();
    return builder.getAnalyzer();
  }
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.