Package org.hibernate.search.engine

Examples of org.hibernate.search.engine.SearchFactoryImplementor


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

    Class<?> clazz = Hibernate.getClass( entity );
    //TODO cache that at the FTSession level
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    //not strictly necessary but a small optimization
    if ( searchFactoryImplementor.getDocumentBuilderIndexedEntity( 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


    //FIXME casting sucks because we do not control what get session from
    Session session = getSession();
    Runnable processor = null;

    try {
      SearchFactoryImplementor factory = ContextHelper.getSearchFactory( session );
      processor = factory.getBackendQueueProcessorFactory().getProcessor( queue );
    }
    finally {
      cleanSessionIfNeeded(session);
    }
    return processor;
View Full Code Here

    //FIXME casting sucks because we do not control what get session from
    Session session = getSession();
    Runnable processor = null;

    try {
      SearchFactoryImplementor factory = ContextHelper.getSearchFactory( session );
      processor = factory.getBackendQueueProcessorFactory().getProcessor( queue );
    }
    finally {
      cleanSessionIfNeeded(session);
    }
    return processor;
View Full Code Here

  public <T> void purgeAll(Class<T> entityType) {
    purge( entityType, null );
  }

  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 = Hibernate.getClass( entity );
    //TODO cache that at the FTSession level
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    //not strictly necessary but a small optimization
    if ( searchFactoryImplementor.getDocumentBuilderIndexedEntity( 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

    //FIXME casting sucks because we do not control what get session from
    Session session = getSession();
    Runnable processor = null;

    try {
      SearchFactoryImplementor factory = ContextHelper.getSearchFactory( session );
      processor = factory.getBackendQueueProcessorFactory().getProcessor( queue );
    }
    finally {
      cleanSessionIfNeeded(session);
    }
    return processor;
View Full Code Here

      // step 1: create hibernate search searchFactory
      SearchConfiguration cfg = new SearchableCacheCfgImpl(classes, properties);
      // set classes in the cfg

      SearchFactoryImplementor searchFactory = new SearchFactoryImpl(cfg);
//       boolean isPojoCache = c instanceof PojoCache; keep this for later usage

      // Step 2: Add cache listener to listen for events happening in the cache.
      //SearchableListener listener = isPojoCache ? new SearchablePojoListener(searchFactory) : new SearchableCoreListener(searchFactory);
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

   * @param entityType
   * @param id
   */
  public void purge(Class entityType, Serializable id) {
    if ( entityType == null ) return;
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    // not strictly necessary but a small optimization plus let's make sure the
    // client didn't mess something up.
    Map<Class, DocumentBuilder<Object>> builders = searchFactoryImplementor.getDocumentBuilders();
    DocumentBuilder<Object> builder = builders.get( entityType );

    if ( builder == null ) {
      throw new IllegalArgumentException( entityType.getName() + " is not a mapped entity (don't forget to add @Indexed)" );
    }
    else {
      WorkType type;
      if ( id == null ) {
        type = WorkType.PURGE_ALL;
      }
      else {
        type = WorkType.PURGE;
      }
      Work work = new Work(entityType, id, type);
      searchFactoryImplementor.getWorker().performWork( work, eventSource );
    }
  }
View Full Code Here

   */
  public void index(Object entity) {
    if (entity == null) return;
    Class clazz = Hibernate.getClass( entity );
    //TODO cache that at the FTSession level
    SearchFactoryImplementor searchFactoryImplementor = getSearchFactoryImplementor();
    //not strictly necessary but a small optimization
    DocumentBuilder<Object> builder = searchFactoryImplementor.getDocumentBuilders().get( clazz );
    if ( builder != null ) {
      Serializable id = session.getIdentifier( entity );
      Work work = new Work(entity, id, WorkType.INDEX);
      searchFactoryImplementor.getWorker().performWork( work, eventSource );
    }
    //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

TOP

Related Classes of org.hibernate.search.engine.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.