Package org.hibernate.search.jpa

Examples of org.hibernate.search.jpa.FullTextEntityManager.createFullTextQuery()


    em.getTransaction().commit();
    em.clear();
    em.getTransaction().begin();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );
    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
View Full Code Here


    em.getTransaction().begin();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );
    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();
View Full Code Here

    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();

    em.clear();
View Full Code Here

    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();

    em.clear();

    em.getTransaction().begin();
View Full Code Here

    em.clear();

    em.getTransaction().begin();
    final QueryBuilder builder = em.getSearchFactory().buildQueryBuilder().forEntity( Clock.class ).get();
    Query query = builder.keyword().onField( "brand" ).matching( "Seiko" ).createQuery();
    FullTextQuery hibernateQuery = em.createFullTextQuery( query, Clock.class );

    hibernateQuery.setHint( "javax.persistence.query.timeout", 100 ); //not too low or we can't reproduce it consistently
    try {
      hibernateQuery.getResultSize();
      fail( "timeout exception should happen" );
View Full Code Here

    em.clear();

    em.getTransaction().begin();
    final QueryBuilder builder = em.getSearchFactory().buildQueryBuilder().forEntity( Clock.class ).get();
    Query query = builder.keyword().onField( "brand" ).matching( "Seiko" ).createQuery();
    FullTextQuery hibernateQuery = em.createFullTextQuery( query, Clock.class );
    List results = hibernateQuery.getResultList();
    assertEquals( 500, results.size() );

    em.clear();
View Full Code Here

    assertEquals( 500, results.size() );

    em.clear();

    query = builder.keyword().onField( "brand" ).matching( "Swatch" ).createQuery();
    hibernateQuery = em.createFullTextQuery( query, Clock.class );
    hibernateQuery.limitExecutionTimeTo( 1, TimeUnit.NANOSECONDS );
    List result = hibernateQuery.getResultList();
    System.out.println( "Result size early: " + result.size() );
    assertEquals( "Test early failure, before the number of results are even fetched", 0, result.size() );
    if ( result.size() == 0 ) {
View Full Code Here

//    assertTrue("Regular failure when some elements are fetched", 0 < results.size() && results.size() < 500 );
//    assertTrue( hibernateQuery.hasPartialResults() );
//
//    fts.clear();

    hibernateQuery = em.createFullTextQuery( query, Clock.class );
    hibernateQuery.limitExecutionTimeTo( 30, TimeUnit.SECONDS );
    results = hibernateQuery.getResultList();
    assertEquals( "Test below limit termination", 500, results.size() );
    assertFalse( hibernateQuery.hasPartialResults() );
View Full Code Here

        .keyword()
        .onField( "text" )
        .matching( "spice" )
        .createQuery();

    ftem.createFullTextQuery( query, Tweet.class ).getResultList();
    final List resultList = em.createQuery( "from " + Tweet.class.getName() ).getResultList();
    Assert.assertEquals( 1, resultList.size() );
    for ( Object o : resultList ) {
      em.remove( o );
    }
View Full Code Here

    em.getTransaction().commit();
    em.clear();
    em.getTransaction().begin();
    QueryParser parser = new QueryParser( getTargetLuceneVersion(), "title", TestConstants.stopAnalyzer );
    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term( "saltQty", "23" ) );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals(
        "getSingleResult and object retrieval", 23,
        ( (Bretzel) em.createFullTextQuery( query ).getSingleResult() ).getSaltQty()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.