Examples of AddLuceneWork


Examples of org.hibernate.search.backend.AddLuceneWork

    boolean searchForContainers = false;
    String idInString = idBridge.objectToString( id );
    if ( workType == WorkType.ADD ) {
      Document doc = getDocument( entity, id );
      queue.add( new AddLuceneWork( id, idInString, entityClass, doc ) );
      searchForContainers = true;
    }
    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 ) );
      searchForContainers = true;
    }
    else if ( workType == WorkType.INDEX ) {
      Document doc = getDocument( entity, id );
      queue.add( new DeleteLuceneWork( id, idInString, entityClass ) );
      LuceneWork work = new AddLuceneWork( id, idInString, entityClass, doc );
      work.setBatch( true );
      queue.add( work );
      searchForContainers = true;
    }

    else {
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

    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

    doc.add( field );
    field = new Field("id", "1", Field.Store.YES, Field.Index.UN_TOKENIZED );
    doc.add( field );
    field = new Field("logo", ts.getLogo(), Field.Store.NO, Field.Index.TOKENIZED );
    doc.add( field );
    LuceneWork luceneWork = new AddLuceneWork(ts.getId(), String.valueOf( ts.getId() ), ts.getClass(), doc );
    List<LuceneWork> queue = new ArrayList<LuceneWork>();
    queue.add( luceneWork );

    //send the queue
    InitialContext context = new InitialContext();
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

        .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

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, 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
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.