Package org.hibernate.search.backend

Examples of org.hibernate.search.backend.LuceneWork


      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


   private List<LuceneWork> transformKeysToStrings(final List<LuceneWork> luceneWorks) {
      final KeyTransformationHandler keyTransformationHandler = queryInterceptor.getKeyTransformationHandler();
      ArrayList<LuceneWork> transformedWorks = new ArrayList<LuceneWork>(luceneWorks.size());
      for (LuceneWork lw : luceneWorks) {
         LuceneWork transformedLuceneWork = lw
               .getWorkDelegate(LuceneWorkTransformationVisitor.INSTANCE)
               .cloneOverridingIdString(lw, keyTransformationHandler);
         transformedWorks.add(transformedLuceneWork);
      }
      return transformedWorks;
View Full Code Here

    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

    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.getClassLoader(),
        "entity class"
    );
    LuceneWork result = new AddLuceneWork(
        id,
        objectIdInString( entityClass, id, conversionContext ),
        entityClass,
        getLuceneDocument(),
        fieldToAnalyzerMap
View Full Code Here

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

    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

    s.getTransaction().commit();
    s.close();
    Assert.assertNull( "unexpected exception detected", errorHandler.getLastException() );
    List<LuceneWork> processedQueue = LeakingLuceneBackend.getLastProcessedQueue();
    Assert.assertEquals( 1, processedQueue.size() );
    LuceneWork luceneWork = processedQueue.get( 0 );
    Assert.assertEquals( "100", luceneWork.getIdInString() );
  }
View Full Code Here

    doc.add( field );
    field = new Field( "logo", shirt.getLogo(), Field.Store.NO, Field.Index.ANALYZED );
    doc.add( field );
    DoubleField numField = new DoubleField( "length", shirt.getLength(), Field.Store.NO );
    doc.add( numField );
    LuceneWork luceneWork = new AddLuceneWork(
        shirt.getId(), String.valueOf( shirt.getId() ), shirt.getClass(), doc
    );
    List<LuceneWork> queue = new ArrayList<LuceneWork>();
    queue.add( luceneWork );
    return queue;
View Full Code Here

    tx.commit();
    s.clear();

    List<LuceneWork> lastProcessedQueue = LeakingLuceneBackend.getLastProcessedQueue();
    assertEquals( 1, lastProcessedQueue.size() );
    LuceneWork luceneWork = lastProcessedQueue.get( 0 );
    assertEquals( "AB123", luceneWork.getIdInString() );

    tx = s.beginTransaction();

    QueryBuilder queryBuilder = getSearchFactory().buildQueryBuilder().forEntity( PersonCustomDocumentId.class ).get();
    Query query = queryBuilder.keyword().onField( "id" ).ignoreAnalyzer().matching( "AB123" ).createQuery();
View Full Code Here

TOP

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

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.