Package org.hibernate.search

Examples of org.hibernate.search.FullTextSession.beginTransaction()


  public void testFetchSizeDefaultFirstAndMax() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:ITech" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    hibQuery.setProjection( "id", "lastname", "dept" );
View Full Code Here


  public void testFetchSizeNonDefaultFirstAndMax() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:ITech" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    hibQuery.setProjection( "id", "lastname", "dept" );
View Full Code Here

  public void testFetchSizeNonDefaultFirstAndMaxNoHits() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:XXX" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    hibQuery.setProjection( "id", "lastname", "dept" );
View Full Code Here

  public void testCurrent() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    s.clear();
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "dept", new StandardAnalyzer() );

    Query query = parser.parse( "dept:ITech" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Employee.class );
    hibQuery.setProjection( "id", "lastname", "dept" );
View Full Code Here

    QueryParser parser = new QueryParser( "name", new StopAnalyzer() );
    Query query = parser.parse( "Elephant" );

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    try {
      org.hibernate.Query hibQuery = s.createFullTextQuery( query, String.class );
      hibQuery.list();
      tx.commit();
      fail();
View Full Code Here

    s.close();
  }

  public void testMultipleEntityPerIndex() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    Clock clock = new Clock( 1, "Seiko" );
    s.save( clock );
    Book book = new Book( 1, "La chute de la petite reine a travers les yeux de Festina", "La chute de la petite reine a travers les yeux de Festina, blahblah" );
    s.save( book );
    AlternateBook alternateBook = new AlternateBook( 1, "La chute de la petite reine a travers les yeux de Festina" );
View Full Code Here

    }
    catch ( IllegalArgumentException iae ) {
      log.debug( "success" );
    }

    tx = s.beginTransaction();
    org.hibernate.Query hibQuery = s.createFullTextQuery( query, Mammal.class );
    assertItsTheElephant( hibQuery.list() );
    tx.commit();

    s.close();
View Full Code Here

  public void testInheritance() throws Exception {
    createTestData();

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();

    QueryParser parser = new QueryParser( "name", new StopAnalyzer() );
    Query query = parser.parse( "Elephant" );
    org.hibernate.Query hibQuery = s.createFullTextQuery( query, Mammal.class );
    assertItsTheElephant( hibQuery.list() );
View Full Code Here

    s.save( book );
    AlternateBook alternateBook = new AlternateBook( 1, "La chute de la petite reine a travers les yeux de Festina" );
    s.save( alternateBook );
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:Festina" );
    org.hibernate.Query hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    List result = hibQuery.list();
View Full Code Here

  public void testPolymorphicQueries() throws Exception {
    createTestData();

    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "name", new StopAnalyzer() );
    Query query = parser.parse( "Elephant" );

    org.hibernate.Query hibQuery = s.createFullTextQuery( query, Mammal.class );
    assertItsTheElephant( hibQuery.list() );
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.