Package org.hibernate.search

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


                    Object o = cursor.get(0);
                    log.debug("indexing instance " + i + ": " + o);
                    ftSession.index(o);
                    if (i % batchSize == 0) {
                        log.debug("ending batch, beginning new batch");
                        ftSession.clear(); // Clear persistence context for each batch
                    }
                    progress.setPercentComplete( new Double(100d/count*i).intValue() );
                    log.debug(progress);

                    if (cursor.isLast())
View Full Code Here


    final Insurance insurance = new Insurance();
    insurance.setName( "Macif" );
    fts.persist( insurance );
    transaction.commit();

    fts.clear();

    transaction = fts.beginTransaction();
    final QueryBuilder b = fts.getSearchFactory()
        .buildQueryBuilder()
        .forEntity( Insurance.class )
View Full Code Here

    final Insurance insurance = new Insurance();
    insurance.setName( "Macif" );
    ftSession.persist( insurance );
    getTransactionManager().commit();

    ftSession.clear();

    getTransactionManager().begin();
    final QueryBuilder b = ftSession.getSearchFactory()
        .buildQueryBuilder()
        .forEntity( Insurance.class )
View Full Code Here

      @SuppressWarnings("unchecked")
      List<Insurance> list = session.createFullTextQuery( luceneQuery ).list();
      assertThat( list ).hasSize( 1 );
      assertThat( list.get( 0 ).getName() ).isEqualTo( "Insurance Corporation" );
      transaction.commit();
      session.clear();
      session.close();
    }
  }

  @Test
View Full Code Here

      assertThat( list ).hasSize( 1 );
      assertThat( list.get( 0 ).getContent() ).isEqualTo( "content" );
      assertThat( list.get( 0 ).getNewsId().getTitle() ).isEqualTo( "title" );
      assertThat( list.get( 0 ).getNewsId().getAuthor() ).isEqualTo( "author" );
      transaction.commit();
      session.clear();
      session.close();
    }
  }

  @AfterClass
View Full Code Here

    Dvd dvd = new Dvd("The dark knight", "Batman returns with it best enomy the Jocker. The dark side of this movies shows up pretty quickly");
    s.persist( dvd );
    dvd = new Dvd("Wall-e", "The tiny little robot comes to Eartch after the dark times and tries to clean it");
    s.persist( dvd );
    tx.commit();
    s.clear();

    tx = s.beginTransaction();
    Map<String, Float> boosts = new HashMap<String, Float>(2);
    boosts.put( "title", new Float(4) );
    boosts.put( "description", new Float(1) );
View Full Code Here

  
   public void testPositionOffsets() throws Exception {
      FullTextSession s = Search.getFullTextSession(openSession());
      createIndex(s);

      s.clear();
      Transaction tx = s.beginTransaction();

      // Here's how to get a reader from a FullTextSession
      SearchFactory searchFactory = s.getSearchFactory();
      DirectoryProvider provider = searchFactory.getDirectoryProviders(ElectricalProperties.class)[0];
View Full Code Here

      Transaction tx = s.beginTransaction();

      Employee e1 = new Employee(1000, "Griffin", "ITech");
      s.save(e1);
      tx.commit();
      s.clear();

      tx = s.beginTransaction();

      // Here's how to get a reader from a FullTextSession
      SearchFactory searchFactory = s.getSearchFactory();
View Full Code Here

  public void testBoostedGetDesc() throws Exception {
    FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
    buildBoostedGetIndex( fullTextSession );

    fullTextSession.clear();
    Transaction tx = fullTextSession.beginTransaction();

    QueryParser authorParser = new QueryParser( "author", new StandardAnalyzer() );
    QueryParser descParser = new QueryParser( "description", new StandardAnalyzer() );
    Query author = authorParser.parse( "Wells" );
View Full Code Here

  public void testBoostedFieldDesc() throws Exception {
    FullTextSession fullTextSession = Search.getFullTextSession( openSession() );
    buildBoostedFieldIndex( fullTextSession );

    fullTextSession.clear();
    Transaction tx = fullTextSession.beginTransaction();

    QueryParser authorParser = new QueryParser( "author", new StandardAnalyzer() );
    QueryParser descParser = new QueryParser( "description", new StandardAnalyzer() );
    Query author = authorParser.parse( "Wells" );
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.