当前位置: 首页>>代码示例>>Java>>正文


Java FullTextEntityManager.purgeAll方法代码示例

本文整理汇总了Java中org.hibernate.search.jpa.FullTextEntityManager.purgeAll方法的典型用法代码示例。如果您正苦于以下问题:Java FullTextEntityManager.purgeAll方法的具体用法?Java FullTextEntityManager.purgeAll怎么用?Java FullTextEntityManager.purgeAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.search.jpa.FullTextEntityManager的用法示例。


在下文中一共展示了FullTextEntityManager.purgeAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: purge

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
public void purge(Class<?> type) {
	FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	if (type == Article.class) {
		fullTextEntityManager.purgeAll(Article.class);
	} else if (type == Product.class) {
		fullTextEntityManager.purgeAll(Product.class);
	}
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:9,代码来源:SearchServiceImpl.java

示例2: beforeFlushFT

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Before
@Transactional
public void beforeFlushFT() {
	FullTextEntityManager ftem = Search.getFullTextEntityManager(myEntityManager);
	ftem.purgeAll(ResourceTable.class);
	ftem.purgeAll(ResourceIndexedSearchParamString.class);
	ftem.flushToIndexes();

	myDaoConfig.setSchedulingDisabled(true);
	myDaoConfig.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:12,代码来源:BaseJpaDstu3Test.java

示例3: test

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void test() throws InterruptedException {
	System.out.println( "starting MassIndexer testCustomUpdatedEntity!" );

	FullTextEntityManager fem = this.searchFactory.getFullTextEntityManager( this.em );
	fem.beginSearchTransaction();
	fem.purgeAll( Sorcerer.class );
	fem.commitSearchTransaction();

	//make sure every Sorcerer is deleted
	assertEquals( 0, fem.createFullTextQuery( new MatchAllDocsQuery(), Sorcerer.class ).getResultSize() );

	this.massIndexer.threadsToLoadObjects( 15 );
	this.massIndexer.batchSizeToLoadObjects( 100 );
	this.massIndexer.batchSizeToLoadIds( 500 );
	long pre = System.currentTimeMillis();
	try {
		this.massIndexer.startAndWait();
	}
	catch (InterruptedException e) {
		throw new SearchException( e );
	}
	long after = System.currentTimeMillis();
	System.out.println( "indexed " + COUNT + " root entities (3 sub each) in " + (after - pre) + "ms." );

	//make sure no Sorcerer was added
	assertEquals( 0, fem.createFullTextQuery( new MatchAllDocsQuery(), Sorcerer.class ).getResultSize() );

	assertEquals( COUNT, fem.createFullTextQuery( new MatchAllDocsQuery(), Place.class ).getResultSize() );
}
 
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:31,代码来源:MassIndexerTest.java

示例4: testObjectHandlerTask

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void testObjectHandlerTask() {
	FullTextEntityManager fem = this.searchFactory.getFullTextEntityManager( this.em );
	fem.beginSearchTransaction();
	fem.purgeAll( Place.class );
	fem.commitSearchTransaction();

	Map<Class<?>, String> idProperties = new HashMap<>();
	idProperties.put( Place.class, "id" );
	BatchBackend batchBackend = new DefaultBatchBackend( this.searchFactory.getSearchIntegrator(), null );
	ObjectHandlerTask handler = new ObjectHandlerTask(
			batchBackend, Place.class, this.searchFactory.getSearchIntegrator().getIndexBinding( Place.class ),
			() -> new BasicEntityProvider( this.em, idProperties ), (x, y) -> {

	}, this.emf.getPersistenceUnitUtil()
	);

	List<UpdateConsumer.UpdateEventInfo> batch = new ArrayList<>();
	batch.add( new UpdateConsumer.UpdateEventInfo( Place.class, this.valinorId, EventType.INSERT ) );
	batch.add( new UpdateConsumer.UpdateEventInfo( Place.class, this.helmsDeepId, EventType.INSERT ) );

	handler.batch( batch );
	handler.run();

	batchBackend.flush( new HashSet<>( Arrays.asList( Place.class ) ) );

	assertEquals( 2, fem.createFullTextQuery( new MatchAllDocsQuery(), Place.class ).getResultList().size() );
}
 
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:29,代码来源:ManualUpdatesIntegrationTest.java

示例5: clearData

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
private void clearData() throws Exception {
	utx.begin();
	em.joinTransaction();
	System.out.println( "Dumping old records..." );
	em.createQuery( "delete from Game" ).executeUpdate();
	utx.commit();

	FullTextEntityManager fem = this.searchFactory.getFullTextEntityManager( this.em );
	fem.beginSearchTransaction();
	fem.purgeAll( Game.class );
	fem.commitSearchTransaction();
}
 
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:13,代码来源:OpenJPATomEEIntegrationTest.java

示例6: clearData

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
private void clearData() throws Exception {
	this.utx.begin();
	this.em.joinTransaction();
	System.out.println( "Dumping old records..." );
	this.em.createQuery( "delete from Game" ).executeUpdate();
	utx.commit();

	FullTextEntityManager fem = this.searchFactory.getFullTextEntityManager( this.em );
	fem.beginSearchTransaction();
	fem.purgeAll( Game.class );
	fem.commitSearchTransaction();
}
 
开发者ID:Hotware,项目名称:Hibernate-Search-GenericJPA,代码行数:13,代码来源:EclipseLinkGlassFishIntegrationTest.java

示例7: indexProductSearch

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Override
public void indexProductSearch() {
	FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
	fullTextEntityManager.purgeAll(ProductImpl.class);
	fullTextEntityManager.createIndexer().start();
}
 
开发者ID:raphaelazzolini,项目名称:mercurius,代码行数:7,代码来源:ProductDAOImpl.java


注:本文中的org.hibernate.search.jpa.FullTextEntityManager.purgeAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。