Package org.hibernate.search.engine.spi

Examples of org.hibernate.search.engine.spi.SearchFactoryImplementor


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

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


    STRING
  }

  public Query createQuery() {
    Query query;
    final SearchFactoryImplementor searchFactory = queryContext.getFactory();
    final DocumentBuilderIndexedEntity documentBuilder = Helper.getDocumentBuilder( queryContext );
    IndexReader indexReader = searchFactory.getIndexReaderAccessor().open( queryContext.getEntityType() );
    // retrieving the docId and building the more like this query form the term vectors must be using the same index reader
    try {
      String[] fieldNames = getAllCompatibleFieldNames( documentBuilder );
      if ( fieldsContext.size() == 0 ) {
        // Use all compatible fields when comparingAllFields is used
        fieldsContext.addAll( fieldNames );
      }
      query = new MoreLikeThisBuilder( documentBuilder, searchFactory )
          .compatibleFieldNames( fieldNames )
          .fieldsContext( fieldsContext )
          .queryContext( queryContext )
          .indexReader( indexReader )
          .inputType( inputType )
          .input( input )
          .otherMoreLikeThisContext( moreLikeThisContext )
          .createQuery();
    }
    finally {
      searchFactory.getIndexReaderAccessor().close( indexReader );
    }
    //TODO implement INPUT.READER
    //TODO implement INOUT.STRING
    return queryCustomizer.setWrappedQuery( query ).createQuery();
  }
View Full Code Here

    }
    return terms;
  }

  static DocumentBuilderIndexedEntity getDocumentBuilder(QueryBuildingContext queryContext) {
    final SearchFactoryImplementor factory = queryContext.getFactory();
    final Class<?> type = queryContext.getEntityType();
    EntityIndexBinding indexBinding = factory.getIndexBinding( type );
    if ( indexBinding == null ) {
      throw new AssertionFailure( "Class is not indexed: " + type );
    }
    return indexBinding.getDocumentBuilder();
  }
View Full Code Here

    purge( entityType, null );
  }

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

   * @throws Exception in case the test fails.
   */
  @Test
  public void testAddWorkGetReplacedByDeleteWork() throws Exception {
    FullTextSession fullTextSession = org.hibernate.search.Search.getFullTextSession( openSession() );
    SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) fullTextSession.getSearchFactory();

    // create test entity
    SpecialPerson person = new SpecialPerson();
    person.setName( "Joe Smith" );

View Full Code Here

      return builder;
   }

   @Override
   public void testIndexPresence() {
      SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) org.infinispan.query.Search.getSearchManager(cache).getSearchFactory();
      for(IndexManager manager :  searchFactory.getIndexManagerHolder().getIndexManagers()) {
         assertTrue(manager.getIndexName().contains(ProtobufValueWrapper.class.getName()));
      }
   }
View Full Code Here

      remoteCache.put("transaction_" + transaction4.getId(), transaction4);
      remoteCache.put("transaction_" + transaction5.getId(), transaction5);
   }

   public void testIndexPresence() {
      SearchFactoryImplementor searchFactory = (SearchFactoryImplementor) org.infinispan.query.Search.getSearchManager(cache).getSearchFactory();
      assertNotNull(searchFactory.getIndexManagerHolder().getIndexManager(ProtobufValueWrapper.class.getName()));
   }
View Full Code Here

    purge( entityType, null );
  }

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

TOP

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