Package org.hibernate.search.engine.spi

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


  }

  private final MutableSearchFactoryState factoryState = new MutableSearchFactoryState();

  public SearchFactoryImplementor buildSearchFactory() {
    SearchFactoryImplementor searchFactoryImplementor;
    if ( rootFactory == null ) {
      if ( classes.size() > 0 ) {
        throw new SearchException( "Cannot add a class if the original SearchFactory is not passed" );
      }
      searchFactoryImplementor = buildNewSearchFactory();
View Full Code Here


  }

  private final MutableSearchFactoryState factoryState = new MutableSearchFactoryState();

  public SearchFactoryImplementor buildSearchFactory() {
    SearchFactoryImplementor searchFactoryImplementor;
    if ( rootFactory == null ) {
      if ( classes.size() > 0 ) {
        throw new SearchException( "Cannot add a class if the original SearchFactory is not passed" );
      }
      searchFactoryImplementor = buildNewSearchFactory();
View Full Code Here

  }

  private final MutableSearchFactoryState factoryState = new MutableSearchFactoryState();

  public SearchFactoryImplementor buildSearchFactory() {
    SearchFactoryImplementor searchFactoryImplementor;
    if ( rootFactory == null ) {
      if ( classes.size() > 0 ) {
        throw new SearchException( "Cannot add a class if the original SearchFactory is not passed" );
      }
      searchFactoryImplementor = buildNewSearchFactory();
View Full Code Here

    purge( entityType, null );
  }

  @Override
  public void flushToIndexes() {
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    searchFactoryImplementor.getWorker().flushWorks( transactionContext );
  }
View Full Code Here

      throw new IllegalArgumentException( "Entity to index should not be null" );
    }

    Class<?> clazz = HibernateHelper.getClass( entity );
    //TODO cache that at the FTSession level
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    //not strictly necessary but a small optimization
    if ( searchFactoryImplementor.getIndexBinding( clazz ) == null ) {
      String msg = "Entity to index is not an @Indexed entity: " + entity.getClass().getName();
      throw new IllegalArgumentException( msg );
    }
    Serializable id = session.getIdentifier( entity );
    Work<T> work = new Work<T>( entity, id, WorkType.INDEX );
    searchFactoryImplementor.getWorker().performWork( work, transactionContext );

    //TODO
    //need to add elements in a queue kept at the Session level
    //the queue will be processed by a Lucene(Auto)FlushEventListener
    //note that we could keep this queue somewhere in the event listener in the mean time but that requires
View Full Code Here

  }

  private final MutableSearchFactoryState factoryState = new MutableSearchFactoryState();

  public SearchFactoryImplementor buildSearchFactory() {
    SearchFactoryImplementor searchFactoryImplementor;
    if ( rootFactory == null ) {
      if ( classes.size() > 0 ) {
        throw new SearchException( "Cannot add a class if the original SearchFactory is not passed" );
      }
      searchFactoryImplementor = buildNewSearchFactory();
View Full Code Here

*/
public class UsingIdentifierRollbackTest extends SearchTestBase {

  @Test
  public void testEntityDeletionWithoutIdentifier() {
    SearchFactoryImplementor searchFactoryImpl = getSearchFactoryImpl();
    MockErrorHandler errorHandler = (MockErrorHandler) searchFactoryImpl.getErrorHandler();

    Session s = getSessionFactory().openSession();
    s.getTransaction().begin();
    s.persist( new Document( "Hibernate in Action", "Object/relational mapping with Hibernate", "blah blah blah" ) );
    s.getTransaction().commit();
View Full Code Here

    Assert.assertNull( "unexpected exception detected", errorHandler.getLastException() );
  }

  @Test
  public void testRolledBackIdentifiersOnUnusualDocumentId() {
    SearchFactoryImplementor searchFactoryImpl = getSearchFactoryImpl();
    MockErrorHandler errorHandler = (MockErrorHandler) searchFactoryImpl.getErrorHandler();

    Session s = getSessionFactory().openSession();
    s.getTransaction().begin();
    s.persist( new PersonWithBrokenSocialSecurityNumber( Long.valueOf( 2 ), "This guy is unaffected by identifier rollback" ) );
    s.getTransaction().commit();
View Full Code Here

        .addAnnotatedClass( Dvd.class )
        .addAnnotatedClass( Book.class )
        .addAnnotatedClass( Nation.class )
        .build();
    FullTextSession fullTextSession = ftsb.openFullTextSession();
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) fullTextSession.getSearchFactory();
    {
      TestableMassIndexerImpl tsii = new TestableMassIndexerImpl( searchFactory, Book.class );
      assertTrue( tsii.getRootEntities().contains( Book.class ) );
      assertFalse( tsii.getRootEntities().contains( ModernBook.class ) );
      assertFalse( tsii.getRootEntities().contains( AncientBook.class ) );
View Full Code Here

    insertAnimals( elephant, spider, bear );

    assertThat( entityIndexBinding.getIndexManagers() ).hasSize( 2 );

    SearchFactoryImplementor newSearchFactory = getIndependentNewSearchFactory();
    entityIndexBinding = newSearchFactory.getIndexBindings().get( Animal.class );

    assertThat( entityIndexBinding.getIndexManagers() ).hasSize( 2 );
  }
View Full Code Here

TOP

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

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.