Package org.hibernate.search.impl

Examples of org.hibernate.search.impl.FullTextSessionImpl


  public static FullTextSession getFullTextSession(Session session) {
    if ( session instanceof FullTextSession ) {
      return ( FullTextSession ) session;
    }
    else {
      return new FullTextSessionImpl( session );
    }
  }
View Full Code Here


  public static FullTextSession getFullTextSession(Session session) {
    if ( session instanceof FullTextSession ) {
      return (FullTextSession) session;
    }
    else {
      return new FullTextSessionImpl( session );
    }
  }
View Full Code Here

    }
    tx.commit();
    s.close();

    //check non created object does get found!!1
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
View Full Code Here

    }
    tx.commit();
    s.close();

    //check non created object does get found!!1
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
    List result = s.createFullTextQuery( parser.parse( "body:create" ) ).list();
    assertEquals( 0, result.size() );
    tx.commit();
    s.close();

    s = new FullTextSessionImpl( openSession() );
    s.getTransaction().begin();
    Statement stmt = s.connection().createStatement();
    stmt.executeUpdate( "update Email set body='Meet the guys who write the software'" );
    stmt.close();
    //insert an object never indexed
    stmt = s.connection().createStatement();
    stmt.executeUpdate( "insert into Email(id, title, body, header) values( + "
        + ( loop + 1 ) + ", 'Bob Sponge', 'Meet the guys who create the software', 'nope')" );
    stmt.close();
    s.getTransaction().commit();
    s.close();

    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    parser = new QueryParser( "id", new StopAnalyzer() );
    result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
    assertEquals( 0, result.size() );
    result = s.createCriteria( Email.class ).list();
    for (int i = 0; i < loop / 2; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    s.index( result.get( loop / 2 ) ); //do the process out of tx
    tx = s.beginTransaction();
    for (int i = loop / 2 + 1; i < loop; i++)
      s.index( result.get( i ) );
    tx.commit(); //do the process
    s.close();

    s = Search.getFullTextSession( openSession() );
    tx = s.beginTransaction();
    //object never indexed
    Email email = (Email) s.get( Email.class, Long.valueOf( loop + 1 ) );
    s.index( email );
    tx.commit();
    s.close();

    //check non indexed object get indexed by s.index
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    result = s.createFullTextQuery( parser.parse( "body:create" ) ).list();
    assertEquals( 1, result.size() );
    tx.commit();
    s.close();
View Full Code Here

    }
    tx.commit();
    s.close();

    //check non created object does get found!!1
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
View Full Code Here

//        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//      }

      s = sf.openSession();
      tx = s.beginTransaction();
      FullTextSession fts = new FullTextSessionImpl( s );
      QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
      Query query;
      try {
        query = parser.parse( "name:emmanuel2" );
      }
      catch (ParseException e) {
        throw new RuntimeException( e );
      }
      boolean results = fts.createFullTextQuery( query ).list().size() > 0;
      //don't test because in case of async, it query happens before actual saving
      //if ( !results ) throw new RuntimeException( "No results!" );
      tx.commit();
      s.close();
View Full Code Here

          e.printStackTrace()//To change body of catch statement use File | Settings | File Templates.
        }

        s = sf.openSession();
        tx = s.beginTransaction();
        FullTextSession fts = new FullTextSessionImpl( s );
        QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
        Query query;
        try {
          query = parser.parse( "name:Gavin" );
        }
        catch (ParseException e) {
          throw new RuntimeException( e );
        }
        boolean results = fts.createFullTextQuery( query ).list().size() > 0;
        //don't test because in case of async, it query happens before actual saving
        //if ( !results ) throw new RuntimeException( "No results!" );
        tx.commit();
        s.close();
View Full Code Here

  public static FullTextSession getFullTextSession(Session session) {
    if ( session instanceof FullTextSessionImpl ) {
      return ( FullTextSession ) session;
    }
    else {
      return new FullTextSessionImpl( session );
    }
  }
View Full Code Here

//        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
//      }

      s = sf.openSession();
      tx = s.beginTransaction();
      FullTextSession fts = new FullTextSessionImpl( s );
      QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
      Query query;
      try {
        query = parser.parse( "name:emmanuel2" );
      }
      catch (ParseException e) {
        throw new RuntimeException( e );
      }
      boolean results = fts.createFullTextQuery( query ).list().size() > 0;
      //don't test because in case of async, it query happens before actual saving
      //if ( !results ) throw new RuntimeException( "No results!" );
      tx.commit();
      s.close();
View Full Code Here

    }
    tx.commit();
    s.close();

    //check non created object does get found!!1
    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    ScrollableResults results = s.createCriteria( Email.class ).scroll( ScrollMode.FORWARD_ONLY );
    int index = 0;
    while ( results.next() ) {
      index++;
View Full Code Here

TOP

Related Classes of org.hibernate.search.impl.FullTextSessionImpl

Copyright © 2018 www.massapicom. 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.