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


Java FullTextEntityManager.flushToIndexes方法代码示例

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


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

示例1: index

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
public void index(Class<?> type) {
	FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	if (type == Article.class) {
		for (int i = 0; i < articleDao.count(); i += 20) {
			List<Article> articles = articleDao.findList(i, 20, null, null);
			for (Article article : articles) {
				fullTextEntityManager.index(article);
			}
			fullTextEntityManager.flushToIndexes();
			fullTextEntityManager.clear();
			articleDao.clear();
		}
	} else if (type == Product.class) {
		for (int i = 0; i < productDao.count(); i += 20) {
			List<Product> products = productDao.findList(i, 20, null, null);
			for (Product product : products) {
				fullTextEntityManager.index(product);
			}
			fullTextEntityManager.flushToIndexes();
			fullTextEntityManager.clear();
			productDao.clear();
		}
	}
}
 
开发者ID:justinbaby,项目名称:my-paper,代码行数:25,代码来源:SearchServiceImpl.java

示例2: searchAdherentSortOnName

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
@Transactional
public void searchAdherentSortOnName() throws Exception {
	// Given
	adherent.setNom("FERRÉ");
	adherentRepository.saveAndFlush(adherent);

	final Adherent secondAdherent = new Adherent();
	secondAdherent.setPrenom(DEFAULT_PRENOM);
	secondAdherent.setNom("BERRUBÉ");
	adherentRepository.saveAndFlush(secondAdherent);

	final FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	fullTextEntityManager.flushToIndexes();

	// When
	restAdherentMockMvc.perform(get("/api/adherents/search?criteria=eRR&sort=nom").accept(TestUtil.APPLICATION_JSON_UTF8)).andExpect(status().isOk())
	.andExpect(jsonPath("$.[*].nom").value(contains("BERRUBÉ", "FERRÉ")));
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:20,代码来源:AdherentResourceTest.java

示例3: test

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void test() {
    final String testValue = "test";

    assertThat(entityWithFullTextRepository.findCount(findByValue(testValue))).isEqualTo(0);

    EntityWithFullText entityWithFullText = new EntityWithFullText();
    entityWithFullText.setValue(testValue);
    entityWithFullText = entityWithFullTextRepository.save(entityWithFullText);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithFullText);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithFullTextRepository.find(findByValue(testValue))).containsExactly(entityWithFullText);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:18,代码来源:EntityWithFullTextRepositoryIT.java

示例4: test

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void test() {
    final String testValue = "test";

    assertThat(entityWithMultipleFullTextRepository.findCount(findByValue(testValue))).isEqualTo(0);

    EntityWithMultipleFullText entityWithMultipleFullText = new EntityWithMultipleFullText();
    entityWithMultipleFullText.setValue1(testValue);
    entityWithMultipleFullText.setValue2("abcdef");
    entityWithMultipleFullText = entityWithMultipleFullTextRepository.save(entityWithMultipleFullText);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithMultipleFullText);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithMultipleFullTextRepository.find(findByValue(testValue))).containsExactly(entityWithMultipleFullText);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:19,代码来源:EntityWithMultipleFullTextRepositoryIT.java

示例5: deep_test

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void deep_test() {
    final String testValue = "test";

    assertThat(entityWithMultipleFullTextRepository.findCount(findByDeepValue(testValue))).isEqualTo(0);

    EntityWithMultipleFullText entityWithMultipleFullText = new EntityWithMultipleFullText();
    entityWithMultipleFullText.setValue1("abcdef");
    EntityWithFullText entityWithFullText = new EntityWithFullText();
    entityWithFullText.setValue(testValue);
    entityWithMultipleFullText.setEntityWithFullText(entityWithFullText);
    entityWithMultipleFullText = entityWithMultipleFullTextRepository.save(entityWithMultipleFullText);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithMultipleFullText);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithMultipleFullTextRepository.find(findByDeepValue(testValue))).containsExactly(entityWithMultipleFullText);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:21,代码来源:EntityWithMultipleFullTextRepositoryIT.java

示例6: test

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void test() {
    final Integer testValue = 1995;

    assertThat(entityWithFullTextIntegerRepository.findCount(findByValue(testValue))).isEqualTo(0);

    EntityWithFullTextInteger entityWithFullTextInteger = new EntityWithFullTextInteger();
    entityWithFullTextInteger.setValue(testValue);
    entityWithFullTextInteger = entityWithFullTextIntegerRepository.save(entityWithFullTextInteger);
    EntityWithFullTextInteger another = new EntityWithFullTextInteger();
    another.setValue(1994);
    entityWithFullTextIntegerRepository.save(another);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithFullTextInteger);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithFullTextIntegerRepository.find(findByValue(testValue))).containsExactly(entityWithFullTextInteger);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:21,代码来源:EntityWithFullTextIntegerRepositoryIT.java

示例7: searchAdherentIgnoreAccent

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
@Transactional
public void searchAdherentIgnoreAccent() throws Exception {
	// Given
	adherent.setPrenom("Gaël");
	adherentRepository.saveAndFlush(adherent);

	final FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	fullTextEntityManager.flushToIndexes();

	// When
	restAdherentMockMvc.perform(get("/api/adherents/search?criteria=gAEl").accept(TestUtil.APPLICATION_JSON_UTF8)).andExpect(status().isOk())
	.andExpect(jsonPath("$.[*].prenom").value(hasItem(adherent.getPrenom())));
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:15,代码来源:AdherentResourceTest.java

示例8: searchAdherentContaining

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
@Transactional
public void searchAdherentContaining() throws Exception {
	// Given
	adherent.setNom("FERRÉ");
	adherentRepository.saveAndFlush(adherent);

	final FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	fullTextEntityManager.flushToIndexes();

	// When
	restAdherentMockMvc.perform(get("/api/adherents/search?criteria=eRrE").accept(TestUtil.APPLICATION_JSON_UTF8)).andExpect(status().isOk())
	.andExpect(jsonPath("$.[*].nom").value(hasItem(adherent.getNom())));
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:15,代码来源:AdherentResourceTest.java

示例9: searchAdherentMultipleTerms

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
@Transactional
public void searchAdherentMultipleTerms() throws Exception {
	// Given
	adherent.setPrenom("Goulven");
	adherent.setNom("Le Breton");
	adherentRepository.saveAndFlush(adherent);

	final FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	fullTextEntityManager.flushToIndexes();

	// When
	restAdherentMockMvc.perform(get("/api/adherents/search?criteria=goulven le b").accept(TestUtil.APPLICATION_JSON_UTF8)).andExpect(status().isOk())
	.andExpect(jsonPath("$.[*].prenom").value(hasItem("Goulven")));
}
 
开发者ID:glebreton,项目名称:lapetiterennes,代码行数:16,代码来源:AdherentResourceTest.java

示例10: 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

示例11: test_similarity

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void test_similarity() {
    assertThat(entityWithFullTextRepository.findCount(findByValueWithSimilarity("tast"))).isEqualTo(0);

    EntityWithFullText entityWithFullText = new EntityWithFullText();
    entityWithFullText.setValue("test");
    entityWithFullText = entityWithFullTextRepository.save(entityWithFullText);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithFullText);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithFullTextRepository.find(findByValueWithSimilarity("tast"))).containsExactly(entityWithFullText);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:16,代码来源:EntityWithFullTextRepositoryIT.java

示例12: testAnd

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
@Test
public void testAnd() {
    final String testValue1 = "abc";
    final String testValue2 = "def";

    assertThat(entityWithMultipleFullTextRepository.findCount(findByValue(testValue1, testValue2))).isEqualTo(0);

    EntityWithMultipleFullText entityWithMultipleFullText = new EntityWithMultipleFullText();
    entityWithMultipleFullText.setValue1(testValue1);
    entityWithMultipleFullText.setValue2(testValue2);
    entityWithMultipleFullText = entityWithMultipleFullTextRepository.save(entityWithMultipleFullText);

    EntityWithMultipleFullText entityWithMultipleFullText2 = new EntityWithMultipleFullText();
    entityWithMultipleFullText2.setValue1(testValue1);
    entityWithMultipleFullText2.setValue2("toto");
    entityWithMultipleFullText2 = entityWithMultipleFullTextRepository.save(entityWithMultipleFullText2);

    EntityWithMultipleFullText entityWithMultipleFullText3 = new EntityWithMultipleFullText();
    entityWithMultipleFullText3.setValue1("toto");
    entityWithMultipleFullText3.setValue2(testValue2);
    entityWithMultipleFullText3 = entityWithMultipleFullTextRepository.save(entityWithMultipleFullText3);

    FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
    fullTextEntityManager.index(entityWithMultipleFullText);
    fullTextEntityManager.index(entityWithMultipleFullText2);
    fullTextEntityManager.index(entityWithMultipleFullText3);
    fullTextEntityManager.flushToIndexes();
    fullTextEntityManager.flush();

    assertThat(entityWithMultipleFullTextRepository.find(findByValue(testValue1, testValue2))).containsExactly(entityWithMultipleFullText);
}
 
开发者ID:jpasearch,项目名称:jpasearch,代码行数:32,代码来源:EntityWithMultipleFullTextRepositoryIT.java

示例13: flush

import org.hibernate.search.jpa.FullTextEntityManager; //导入方法依赖的package包/类
/**
 * flush to JPA + Lucene.  JPA queries trigger a JPA flush, but Hibernate Search
 * only flushes on TX commit by default.  But are using a TX rollback test strategy, so we
 * need to flush Lucene manually.
 */
private void flush() {
	entityManager.flush();
	FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(entityManager);
	fullTextEntityManager.flushToIndexes();
}
 
开发者ID:IHTSDO,项目名称:MLDS,代码行数:11,代码来源:AffiliateFullTextSearchTest.java


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