public EntityInstanceWorkContext push(Iterable<?> entries) { return push( StreamSupport.stream( entries.spliterator(), false ) ); }
public EntityInstanceWorkContext push(Object ... entries) { return push( Arrays.stream( entries ) ); }
@Test public void testProvidedIdMapping() throws Exception { FullTextSession fullTextSession = Search.getFullTextSession( openSession() ); SearchIntegrator sf = fullTextSession.getSearchFactory().unwrap( SearchIntegrator.class ); ProvidedIdEntry person1 = new ProvidedIdEntry(); person1.setName( "Big Goat" ); person1.setBlurb( "Eats grass" ); ProvidedIdEntry person2 = new ProvidedIdEntry(); person2.setName( "Mini Goat" ); person2.setBlurb( "Eats cheese" ); ProvidedIdEntry person3 = new ProvidedIdEntry(); person3.setName( "Regular goat" ); person3.setBlurb( "Is anorexic" ); SearchITHelper helper = new SearchITHelper( () -> sf ); helper.index() .push( person1, 1 ) .push( person2, 2 ) .push( person3, 3 ) .execute(); Transaction transaction = fullTextSession.beginTransaction(); //we cannot use FTQuery because @ProvidedId does not provide the getter id and Hibernate Hsearch Query extension //needs it. So we use plain HSQuery helper.assertThat( "providedidentry.name", "goat" ) .from( ProvidedIdEntry.class ) .hasResultSize( 3 ); transaction.commit(); getSession().close(); }
@Test public void testAddingClassSimpleAPI() throws Exception { searchIntegrator = integratorResource.create( new SearchConfigurationForTest() ); searchIntegrator.addClasses( A.class ); helper.index( new A( 1, "Emmanuel" ), 1 ); helper.assertThat( "name", "emmanuel" ) .from( A.class ) .hasResultSize( 1 ); searchIntegrator.addClasses( B.class, C.class ); helper.index() .push( new B( 1, "Noel" ), 1 ) .push( new C( 1, "Vincent" ), 1 ) .execute(); helper.assertThat( "name", "noel" ) .from( B.class ) .hasResultSize( 1 ); helper.assertThat( "name", "vincent" ) .from( C.class ) .hasResultSize( 1 ); }
public void index(Object ... entries) { index().push( entries ).execute(); }
public void add(Object ... entries) { add().push( entries ).execute(); }
public void index(Iterable<?> entries) { index().push( entries ).execute(); }
@Test @TestForIssue(jiraKey = "HSEARCH-2420") public void testWithCustomId() throws Exception { String customId = "S:custom_id_325"; User user = new User(); user.setId( customId ); user.setSurname( "Lee" ); helper.executor( "tenant_id_with_underscores" ).add() .push( user, customId ) .execute(); helper.assertThat( "surname", "lee" ) .from( User.class ) .matchesExactlyIds( customId ); }
public void add(Object entry, Serializable id) { add().push( entry, id ).execute(); }
public void index(Object entry, Serializable id) { index().push( entry, id ).execute(); }
public void add(Iterable<?> entries) { add().push( entries ).execute(); }
private void generateData(int firstId, int count) throws Exception { EntityInstanceWorkContext executor = helper.add(); for ( int id = firstId; id < firstId + count; ++id ) { executor.push( new IndexedObject( id ), id ); } executor.execute(); }