Package org.hibernate.search.spi

Examples of org.hibernate.search.spi.SearchFactoryBuilder


    return delegate.getDirectoryProviderData();
  }

  public void addClasses(Class<?>... classes) {
    //todo optimize the list of
    final SearchFactoryBuilder builder = new SearchFactoryBuilder().currentFactory( this );
    for ( Class<?> type : classes ) {
      builder.addClass( type );
    }
    try {
      mutating.lock();
      builder.buildSearchFactory();
    }
    finally {
      mutating.unlock();
    }
  }
View Full Code Here


         GlobalComponentRegistry globalComponentRegistry = cr.getGlobalComponentRegistry();
         EmbeddedCacheManager uninitializedCacheManager = globalComponentRegistry.getComponent(EmbeddedCacheManager.class);
         indexingProperties = addProgrammaticMappings(indexingProperties, cr);
         // Set up the search factory for Hibernate Search first.
         SearchConfiguration config = new SearchableCacheConfiguration(new Class[0], indexingProperties, uninitializedCacheManager, cr);
         searchFactory = new SearchFactoryBuilder().configuration(config).buildSearchFactory();
         cr.registerComponent(searchFactory, SearchFactoryIntegrator.class);
      }
      return searchFactory;
   }
View Full Code Here

         GlobalComponentRegistry globalComponentRegistry = cr.getGlobalComponentRegistry();
         EmbeddedCacheManager uninitializedCacheManager = globalComponentRegistry.getComponent(EmbeddedCacheManager.class);
         indexingProperties = addProgrammaticMappings(indexingProperties, cr);
         // Set up the search factory for Hibernate Search first.
         SearchConfiguration config = new SearchableCacheConfiguration(new Class[0], indexingProperties, uninitializedCacheManager, cr);
         searchFactory = new SearchFactoryBuilder().configuration(config).buildSearchFactory();
         cr.registerComponent(searchFactory, SearchFactoryIntegrator.class);
      }
      return searchFactory;
   }
View Full Code Here

    return delegate.getDocumentBuildersContainedEntities();
  }

  public void addClasses(Class<?>... classes) {
    //todo optimize the list of
    final SearchFactoryBuilder builder = new SearchFactoryBuilder().currentFactory( this );
    for ( Class<?> type : classes ) {
      builder.addClass( type );
    }
    try {
      mutating.lock();
      builder.buildSearchFactory();
    }
    finally {
      mutating.unlock();
    }
  }
View Full Code Here

    //The most practical way to figure out if the property was applied is to provide it with
    //an illegal value to then verify the failure.
    exceptions.expect( SearchException.class );
    exceptions.expectMessage( "HSEARCH000103" );
    new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
  }
View Full Code Here

    SearchConfiguration conf = new HibernateManualConfiguration()
        .addClass( Theater.class )
        .addClass( Chain.class );
    boolean throwException = false;
    try {
      SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( conf ).buildSearchFactory();
      sf.close();
    }
    catch (SearchException e) {
      assertThat( e.getMessage() ).contains( "TheaterBridgeProvider1" );
      throwException = true;
View Full Code Here

      .property( "id", ElementType.FIELD ).documentId()
      .property( "title", ElementType.FIELD ).field()
      ;
    cfg.setProgrammaticMapping( mapping );
    cfg.addClass( Document.class );
    MutableSearchFactory sf = (MutableSearchFactory) new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
    try {
      assertEquals( expectation, extractWorkspace( sf, Document.class ).areSingleTermDeletesSafe() );

      // trigger a SearchFactory rebuild:
      sf.addClasses( Dvd.class, Book.class );
View Full Code Here

      .property( "id", ElementType.FIELD ).documentId()
      .property( "title", ElementType.FIELD ).field()
      ;
    cfg.setProgrammaticMapping( mapping );
    cfg.addClass( Document.class );
    MutableSearchFactory sf = (MutableSearchFactory) new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
    try {
      Assert.assertEquals( expectation, sf.isTransactionManagerExpected() );
      // trigger a SearchFactory rebuild:
      sf.addClasses( Dvd.class );
      // and verify the option is not lost:
View Full Code Here

    SearchConfigurationForTest configuration = new SearchConfigurationForTest()
        .addClass( A.class )
        .addClass( AbstractA.class )
        .addClass( D.class );

    SearchFactoryImplementor searchFactory = new SearchFactoryBuilder().configuration( configuration ).buildSearchFactory();
    searchFactory.close();
    Assert.assertEquals( "Wrong invocation count", 1, BytemanHelper.getAndResetInvocationCount() );
  }
View Full Code Here

      SearchConfigurationForTest configuration = new SearchConfigurationForTest()
          .addClass( B.class )
          .addClass( AbstractB.class )
          .addClass( D.class );

      new SearchFactoryBuilder().configuration( configuration ).buildSearchFactory();
      fail( "Invalid configuration should throw an exception" );
    }
    catch (SearchException e) {
      assertTrue( "Invalid exception code", e.getMessage().startsWith( "HSEARCH000216" ) );
    }
View Full Code Here

TOP

Related Classes of org.hibernate.search.spi.SearchFactoryBuilder

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.