Package org.hibernate.search

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


    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    Transaction tx;
    s.clear();
    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", FullTextQuery.THIS, FullTextQuery.SCORE, FullTextQuery.ID );
View Full Code Here


    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    Transaction tx;
    s.clear();
    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(
View Full Code Here

    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

    Transaction tx;
    s.clear();
    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(
View Full Code Here

    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

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

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

    FullTextSession s = Search.getFullTextSession( openSession() );
    prepEmployeeIndex( s );

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

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

    tx.commit();
  }

  public void testProjection() throws Exception {
    FullTextSession s = Search.getFullTextSession( openSession() );
    Transaction tx = s.beginTransaction();
    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"
    );
View Full Code Here

    emmanuel.setName( "Emmanuel" );
    s.save( emmanuel );
    book.setMainAuthor( emmanuel );
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:Festina" );
    org.hibernate.search.FullTextQuery hibQuery = s.createFullTextQuery( query, Book.class );
    hibQuery.setProjection( "id", "summary", "mainAuthor.name" );
View Full Code Here

   */
  public void testProperCopy() throws Exception {

    // assert that the salve index is empty
    FullTextSession fullTextSession = Search.getFullTextSession( getSlaveSession() );
    Transaction tx = fullTextSession.beginTransaction();
    QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
    List result = fullTextSession.createFullTextQuery( parser.parse( "location:texas" ) ).list();
    assertEquals( "No copy yet, fresh index expected", 0, result.size() );
    tx.commit();
    fullTextSession.close();
View Full Code Here

    Thread.sleep( waitPeriodMilli );

    // assert that the master hass indexed the snowstorm
    log.info( "Searching master" );
    fullTextSession = Search.getFullTextSession( getMasterSession() );
    tx = fullTextSession.beginTransaction();
    result = fullTextSession.createFullTextQuery( parser.parse( "location:dallas" ) ).list();
    assertEquals( "Original should get one", 1, result.size() );
    tx.commit();
    fullTextSession.close();
View Full Code Here

    fullTextSession.close();

    // assert that index got copied to the salve as well
    log.info( "Searching slave" );
    fullTextSession = Search.getFullTextSession( getSlaveSession() );
    tx = fullTextSession.beginTransaction();
    result = fullTextSession.createFullTextQuery( parser.parse( "location:dallas" ) ).list();
    assertEquals( "First copy did not work out", 1, result.size() );
    tx.commit();
    fullTextSession.close();
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.