Package org.hibernate.search.backend

Examples of org.hibernate.search.backend.DeleteLuceneWork


      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


  }
 
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue, ConversionContext contextualBridge) {
    String idInString = objectToString( idBridge, idKeywordName, id, contextualBridge );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete) {
      queue.add( createAddWork( entityClass, entity, id, idInString, this.instanceInitializer, contextualBridge ) );
    }
    else if ( add && delete ) {
View Full Code Here

  }
 
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, boolean batch, List<LuceneWork> queue) {
    String idInString = objectToString( idBridge, idKeywordName, id );
    if ( delete ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    if ( add ) {
      queue.add( createAddWork( entityClass, entity, id, idInString, batch ) );
    }
  }
View Full Code Here

      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

    Class<?> entityClass = ClassLoaderHelper.classForName(
        entityClassName,
        LuceneWorkHydrator.class.getClassLoader(),
        "entity class"
    );
    LuceneWork result = new DeleteLuceneWork(
        id,
        objectIdInString( entityClass, id, conversionContext ),
        entityClass
    );
    results.add( result );
View Full Code Here

    Class<?> entityClass = ClassLoaderHelper.classForName(
        entityClassName,
        LuceneWorkHydrator.class,
        "entity class"
    );
    LuceneWork result = new DeleteLuceneWork(
        id,
        objectIdInString( entityClass, id, conversionContext ),
        entityClass
    );
    results.add( result );
View Full Code Here

  }
 
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue, ConversionContext contextualBridge) {
    String idInString = objectToString( idBridge, idKeywordName, id, contextualBridge );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete) {
      queue.add( createAddWork( entityClass, entity, id, idInString, this.instanceInitalizer, contextualBridge ) );
    }
    else if ( add && delete ) {
View Full Code Here

  @Override
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue, ConversionContext contextualBridge) {
    DocumentFieldMetadata idFieldMetadata = idPropertyMetadata.getFieldMetadata( idFieldName );
    String idInString = objectToString( getIdBridge(), idFieldMetadata.getName(), id, contextualBridge );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete ) {
      queue.add(
          createAddWork(
              entityClass,
View Full Code Here

    Class<?> entityClass = ClassLoaderHelper.classForName(
        entityClassName,
        LuceneWorkHydrator.class,
        "entity class"
    );
    LuceneWork result = new DeleteLuceneWork(
        id,
        objectIdInString( entityClass, id ),
        entityClass
    );
    results.add( result );
View Full Code Here

  }
 
  public void addWorkToQueue(Class<T> entityClass, T entity, Serializable id, boolean delete, boolean add, List<LuceneWork> queue) {
    String idInString = objectToString( idBridge, idKeywordName, id );
    if ( delete && !add ) {
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
    }
    else if ( add && !delete) {
      queue.add( createAddWork( entityClass, entity, id, idInString, this.classHelper ) );
    }
    else if ( add && delete ) {
View Full Code Here

TOP

Related Classes of org.hibernate.search.backend.DeleteLuceneWork

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.