Examples of AddLuceneWork


Examples of org.hibernate.search.backend.AddLuceneWork

    // FIXME for improved performance: avoid loading them in an early phase.
    if ( entityIndexBinding != null ) {
      EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor();
      if ( isNotSkippable( interceptor, entity ) ) {
        Serializable id = session.getIdentifier( entity );
        AddLuceneWork addWork = createAddLuceneWork( entity, sessionInitializer, conversionContext, id, clazz,
            entityIndexBinding );
        backend.enqueueAsyncWork( addWork );
      }
    }
  }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

      if ( duplicateDelete ) return;

      String idInString = idBridge.objectToString( id );
      if ( workType == WorkType.ADD ) {
        Document doc = getDocument( entity, id );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc ) );
      }
      else if ( workType == WorkType.DELETE || workType == WorkType.PURGE ) {
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
      }
      else if ( workType == WorkType.PURGE_ALL ) {
        queue.add( new PurgeAllLuceneWork( entityClass ) );
      }
      else if ( workType == WorkType.UPDATE || workType == WorkType.COLLECTION ) {
        Document doc = getDocument( entity, id );
        /**
         * even with Lucene 2.1, use of indexWriter to update is not an option
         * We can only delete by term, and the index doesn't have a term that
         * uniquely identify the entry.
         * But essentially the optimization we are doing is the same Lucene is doing, the only extra cost is the
         * double file opening.
         */
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc ) );
      }
      else if ( workType == WorkType.INDEX ) {
        Document doc = getDocument( entity, id );
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc, true ) );
      }
      else {
        throw new AssertionFailure( "Unknown WorkType: " + workType );
      }
    }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

  }

  public AddLuceneWork createAddWork(Class<T> entityClass, T entity, Serializable id, String idInString, InstanceInitializer sessionInitializer, ConversionContext conversionContext) {
    Map<String, String> fieldToAnalyzerMap = new HashMap<String, String>();
    Document doc = getDocument( entity, id, fieldToAnalyzerMap, sessionInitializer, conversionContext );
    final AddLuceneWork addWork;
    if ( fieldToAnalyzerMap.isEmpty() ) {
      addWork = new AddLuceneWork( id, idInString, entityClass, doc );
    }
    else {
      addWork = new AddLuceneWork( id, idInString, entityClass, doc, fieldToAnalyzerMap );
    }
    return addWork;
  }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

  }

  public AddLuceneWork createAddWork(Class<T> entityClass, T entity, Serializable id, String idInString, boolean isBatch) {
    Map<String, String> fieldToAnalyzerMap = new HashMap<String, String>();
    Document doc = getDocument( entity, id, fieldToAnalyzerMap );
    AddLuceneWork addWork;
    if ( fieldToAnalyzerMap.isEmpty() ) {
      addWork = new AddLuceneWork( id, idInString, entityClass, doc, isBatch );
    }
    else {
      addWork = new AddLuceneWork( id, idInString, entityClass, doc, fieldToAnalyzerMap, isBatch );
    }
    return addWork;
  }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

    // FIXME for improved performance: avoid loading them in an early phase.
    if ( entityIndexBinding != null ) {
      EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor();
      if ( isNotSkippable( interceptor, entity ) ) {
        Serializable id = session.getIdentifier( entity );
        AddLuceneWork addWork = createAddLuceneWork( entity, sessionInitializer, conversionContext, id, clazz,
            entityIndexBinding );
        backend.enqueueAsyncWork( addWork );
      }
    }
  }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

    finally {
      conversionContext.popProperty();
    }
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork(
        clazz,
        entity,
        id,
        idInString,
        sessionInitializer,
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

      if ( duplicateDelete ) return;

      String idInString = idBridge.objectToString( id );
      if ( workType == WorkType.ADD ) {
        Document doc = getDocument( entity, id );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc ) );
      }
      else if ( workType == WorkType.DELETE || workType == WorkType.PURGE ) {
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
      }
      else if ( workType == WorkType.PURGE_ALL ) {
        queue.add( new PurgeAllLuceneWork( entityClass ) );
      }
      else if ( workType == WorkType.UPDATE || workType == WorkType.COLLECTION ) {
        Document doc = getDocument( entity, id );
        /**
         * even with Lucene 2.1, use of indexWriter to update is not an option
         * We can only delete by term, and the index doesn't have a term that
         * uniquely identify the entry.
         * But essentially the optimization we are doing is the same Lucene is doing, the only extra cost is the
         * double file opening.
         */
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc ) );
      }
      else if ( workType == WorkType.INDEX ) {
        Document doc = getDocument( entity, id );
        queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
        queue.add( new AddLuceneWork( id, idInString, entityClass, doc, true ) );
      }
      else {
        throw new AssertionFailure( "Unknown WorkType: " + workType );
      }
    }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

        .setFieldName(docBuilder.getIdKeywordName())
        .setFieldBridge(idBridge);
    String idInString = contextualBridge.objectToString( id );
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork( clazz, entity, id, idInString, sessionInitializer );
    backend.enqueueAsyncWork( addWork );
  }
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

    finally {
      conversionContext.popProperty();
    }
    //depending on the complexity of the object graph going to be indexed it's possible
    //that we hit the database several times during work construction.
    AddLuceneWork addWork = docBuilder.createAddWork(
        clazz,
        entity,
        id,
        idInString,
        sessionInitializer,
View Full Code Here

Examples of org.hibernate.search.backend.AddLuceneWork

    Class<?> entityClass = ClassLoaderHelper.classForName(
        entityClassName,
        LuceneWorkHydrator.class.getClassLoader(),
        "entity class"
    );
    LuceneWork result = new AddLuceneWork(
        id,
        objectIdInString( entityClass, id, conversionContext ),
        entityClass,
        getLuceneDocument(),
        fieldToAnalyzerMap
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.