Package org.apache.lucene.analysis

Examples of org.apache.lucene.analysis.StopAnalyzer


    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


        m.setName("Elephant Jr");
        s.save(m);
    tx.commit();//post commit events for lucene
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser("name", new StopAnalyzer() );

    Query query;
    org.hibernate.Query hibQuery;

        query = parser.parse( "Elephant" );
View Full Code Here

      if ( index % 5 == 0 ) s.clear();
    }
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
    List result = s.createFullTextQuery( parser.parse( "body:create" ) ).list();
    assertEquals( 14, result.size() );
    for (Object object : result) {
      s.delete( object );
    }
View Full Code Here

    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();
    s.connection().createStatement().executeUpdate( "update Email set body='Meet the guys who write the software'" );
    //insert an object never indexed
    s.connection().createStatement().executeUpdate( "insert into Email(id, title, body, header) values( + "
        + ( loop + 1 ) + ", 'Bob Sponge', 'Meet the guys who create the software', 'nope')" );
    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 ) );
View Full Code Here

    //wait for the message to be processed
    Thread.sleep( 1000 );

    FullTextSession ftSess = Search.createFullTextSession( openSession( ) );
    ftSess.getTransaction().begin();
    QueryParser parser = new QueryParser( "id", new StopAnalyzer() );
    Query luceneQuery = parser.parse( "logo:jboss" );
    org.hibernate.Query query = ftSess.createFullTextQuery( luceneQuery );
    List result = query.list();
    assertEquals( 1, result.size() );
    ftSess.delete( result.get( 0 ) );
View Full Code Here

  public void testProperCopy() throws Exception {

    // assert that the salve index is empty
    FullTextSession fullTextSession = Search.createFullTextSession( 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

    book = new Book( 2, "La gloire de mon pre", "Les deboires de mon pre en vlo" );
    s.save( book );
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

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

    book = new Book( 2, "La gloire de mon pre", "Les deboires de mon pre en vlo" );
    s.save( book );
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:Festina Or brand:Seiko" );
    Statistics stats = s.getSessionFactory().getStatistics();
    stats.clear();
    boolean enabled = stats.isStatisticsEnabled();
View Full Code Here

    book = new Book( 2, "La gloire de mon pre", "Les deboires de mon pre en vlo" );
    s.save( book );
    tx.commit();
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

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

    book = new Book( 2, "La gloire de mon pre", "Les deboires de mon pre en vlo" );
    s.save( book );
    tx.commit();//post commit events for lucene
    s.clear();
    tx = s.beginTransaction();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );

    Query query = parser.parse( "summary:noword" );
    org.hibernate.Query hibQuery = s.createFullTextQuery( query, Clock.class, Book.class );
    Iterator result = hibQuery.iterate();
    assertNotNull( result );
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.StopAnalyzer

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.