本文整理汇总了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();
}
}
}
示例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É")));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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())));
}
示例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())));
}
示例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")));
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}