Package org.hibernate.search.impl

Examples of org.hibernate.search.impl.FullTextSessionImpl


          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(
            TestConstants.getTargetLuceneVersion(),
            "id", TestConstants.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

  private Search() {
  }

  public static FullTextSession createFullTextSession(Session session) {
    return new FullTextSessionImpl(session);
  }
View Full Code Here

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

    s = new FullTextSessionImpl( openSession() );
    s.getTransaction().begin();
    s.connection().createStatement().executeUpdate( "update Email set body='Meet the guys who write the software'");
    s.getTransaction().commit();
    s.close();

    s = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser("id", new StopAnalyzer() );
    List 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 = new FullTextSessionImpl( openSession() );
    tx = s.beginTransaction();
    result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
    assertEquals( loop, result.size() );
    for (Object o : result) s.delete( o );
    tx.commit();
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

  public static FullTextSession createFullTextSession(Session session) {
    if (session instanceof FullTextSessionImpl) {
      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

  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();

        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

  public static FullTextSession getFullTextSession(Session session) {
    if (session instanceof FullTextSessionImpl) {
      return (FullTextSession) session;
    }
    else {
      return new FullTextSessionImpl(session);
    }
  }
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.