Package org.hibernate.search.spi

Examples of org.hibernate.search.spi.SearchFactoryBuilder


    QueryParser parser = new QueryParser(
        TestConstants.getTargetLuceneVersion(),
        "name",
        TestConstants.standardAnalyzer
    );
    final SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( new SearchConfigurationForTest() ).buildSearchFactory();
    try {
      List<DoAddClasses> runnables = new ArrayList<DoAddClasses>( 10 );
      final int nbrOfThread = 10;
      final int nbrOfClassesPerThread = 10;
      for ( int i = 0; i < nbrOfThread; i++ ) {
View Full Code Here


      cfg.addProperty( key, configuration.getProperty( key ) );
    }
    for ( Class<?> c : entities ) {
      cfg.addClass( c );
    }
    sf = new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
  }
View Full Code Here

      .addProperty( "hibernate.search.index2.exclusive_index_use", "false" ) //close all writers closed aggressively
      .addClass( Book.class )
      .addClass( Dvd.class )
      ;
    overrideProperties( cfg ); //allow extending tests with different configuration
    return new SearchFactoryBuilder()
      .configuration( cfg )
      .buildSearchFactory();
  }
View Full Code Here

  private SearchFactoryImplementor createSearchFactory(Class<?> clazz) {
    SearchConfigurationForTest configuration = new SearchConfigurationForTest()
        .addClass( clazz );

    return new SearchFactoryBuilder().configuration( configuration ).buildSearchFactory();
  }
View Full Code Here

   */
  private static void bootConfiguration(SearchConfigurationForTest cfg) throws Throwable {
    cfg.addClass( Dvd.class );
    SearchFactoryImplementor buildSearchFactory = null;
    try {
      buildSearchFactory = new SearchFactoryBuilder().configuration( cfg ).buildSearchFactory();
    }
    catch (SearchException se) {
      //we know we're getting a generic failure, but we want to make assert on the details message of
      // the cause:
      throw se.getCause();
View Full Code Here

  @Test(expected = SearchException.class)
  public void testAgainstInfiniteTypeLoop() throws Exception {
    final SearchConfigurationForTest configuration = new HibernateManualConfiguration()
        .addClass( BrokenMammal.class );
    try {
      SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( configuration )
          .buildSearchFactory();
    }
    catch (SearchException e) {
      assertThat( e.getMessage() ).contains( "HSEARCH000221" );
      throw e;
View Full Code Here

        .addProperty( "hibernate.jndi.class", "org.osjava.sj.SimpleContextFactory" )
        .addProperty( "hibernate.jndi.org.osjava.sj.root", simpleJndiDir.getAbsolutePath() )
        .addProperty( "hibernate.jndi.org.osjava.sj.jndi.shared", "true" )
        .addProperty( Environment.JMX_ENABLED, "true" );

    new SearchFactoryBuilder().configuration( configuration ).buildSearchFactory();

    // if there are problems with the JMX registration there will be an exception when the new factory is build
    new SearchFactoryBuilder().configuration( configuration ).buildSearchFactory();
  }
View Full Code Here

        .addProperty( "hibernate.search.default.directory_provider", "ram" )
        .addProperty( "hibernate.search.lucene_version", TestConstants.getTargetLuceneVersion().toString() )
        .addClass( Foo.class );
    boolean throwException = false;
    try {
      SearchFactoryImplementor sf = new SearchFactoryBuilder().configuration( conf ).buildSearchFactory();
      sf.close();
    }
    catch (SearchException e) {
      assertThat( e.getMessage() ).startsWith( "HSEARCH000151" );
      throwException = true;
View Full Code Here

         GlobalComponentRegistry globalComponentRegistry = cr.getGlobalComponentRegistry();
         EmbeddedCacheManager uninitializedCacheManager = globalComponentRegistry.getComponent(EmbeddedCacheManager.class);
         indexingProperties = addMappingsForRemoteQuery(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();
  }

  @Override
  public void addClasses(Class<?>... classes) {
    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

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.