Examples of createFullTextQuery()


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

    Query query = parser.parse( "combi OR sport" );

    Criteria criteria = session.createCriteria( AbstractCar.class );
    criteria.add( Restrictions.eq( "hasColor", Boolean.FALSE ) );

    org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery( query )
        .setCriteriaQuery( criteria );
    List result = hibQuery.list();
    assertEquals( 2, result.size() );
    tx.commit();
    session.close();
View Full Code Here

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

    Criteria criteria = session.createCriteria( AbstractCar.class );
    criteria.add( Restrictions.eq( "hasColor", Boolean.FALSE ) );

    try {
      org.hibernate.Query hibQuery = fullTextSession.createFullTextQuery( query, AbstractCar.class, Bike.class )
          .setCriteriaQuery( criteria );
      hibQuery.list();
      fail();
    }
    catch ( SearchException se ) {
View Full Code Here

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

    FullTextSession ftSess = Search.getFullTextSession( 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 ) );
    ftSess.getTransaction().commit();
    ftSess.close();
View Full Code Here

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

    query.add( author, BooleanClause.Occur.SHOULD );
    query.add( desc, BooleanClause.Occur.SHOULD );
    //System.out.println( query.toString() );

    org.hibernate.search.FullTextQuery hibQuery =
        fullTextSession.createFullTextQuery( query, BoostedGetDescriptionLibrary.class );
    List results = hibQuery.list();

    //System.out.println( hibQuery.explain( 0 ) );
    //System.out.println( hibQuery.explain( 1 ) );
View Full Code Here

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

    query.add( author, BooleanClause.Occur.SHOULD );
    query.add( desc, BooleanClause.Occur.SHOULD );
    //System.out.println( query.toString() );

    org.hibernate.search.FullTextQuery hibQuery =
        fullTextSession.createFullTextQuery( query, BoostedFieldDescriptionLibrary.class );
    List results = hibQuery.list();

    assertTrue(
        "incorrect document boost",
        ( ( BoostedFieldDescriptionLibrary ) results.get( 0 ) ).getDescription().startsWith( "Martians" )
View Full Code Here

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

    query.add( author, BooleanClause.Occur.SHOULD );
    query.add( desc, BooleanClause.Occur.SHOULD );
    //System.out.println( query.toString() );

    org.hibernate.search.FullTextQuery hibQuery =
        fullTextSession.createFullTextQuery( query, BoostedDescriptionLibrary.class );
    List results = hibQuery.list();

    //System.out.println( hibQuery.explain( 0 ) );
    //System.out.println( hibQuery.explain( 1 ) );
View Full Code Here

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

    // search if the record made it into the index
    tx = s.beginTransaction();
    String searchQuery = "Joe";
    QueryParser parser = new QueryParser( "Content", new StandardAnalyzer() );
    Query luceneQuery = parser.parse( searchQuery );
    FullTextQuery query = s.createFullTextQuery( luceneQuery );
    List results = query.list();
    assertTrue( "We should have a hit", results.size() == 1 );
    tx.commit();

    // Now try to delete
View Full Code Here

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

        List result;

        query = parser.parse("double2:[2.1 TO 2.1] AND float2:[2.1 TO 2.1] " +
        "AND integerv2:[2 TO 2.1] AND long2:[2 TO 2.1] AND type:\"dog\" AND storm:false");

    result = session.createFullTextQuery(query).list();
        assertEquals( "find primitives and do not fail on null", 1, result.size() );

        query = parser.parse("double1:[2.1 TO 2.1] OR float1:[2.1 TO 2.1] OR integerv1:[2 TO 2.1] OR long1:[2 TO 2.1]");
        result = session.createFullTextQuery(query).list();
        assertEquals( "null elements should not be stored", 0, result.size() ); //the query is dumb because restrictive
View Full Code Here

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

    result = session.createFullTextQuery(query).list();
        assertEquals( "find primitives and do not fail on null", 1, result.size() );

        query = parser.parse("double1:[2.1 TO 2.1] OR float1:[2.1 TO 2.1] OR integerv1:[2 TO 2.1] OR long1:[2 TO 2.1]");
        result = session.createFullTextQuery(query).list();
        assertEquals( "null elements should not be stored", 0, result.size() ); //the query is dumb because restrictive

    query = parser.parse("type:dog");
        result = session.createFullTextQuery(query).setProjection( "type" ).list();
        assertEquals( "Enum projection works", 1, result.size() ); //the query is dumb because restrictive
View Full Code Here

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

        query = parser.parse("double1:[2.1 TO 2.1] OR float1:[2.1 TO 2.1] OR integerv1:[2 TO 2.1] OR long1:[2 TO 2.1]");
        result = session.createFullTextQuery(query).list();
        assertEquals( "null elements should not be stored", 0, result.size() ); //the query is dumb because restrictive

    query = parser.parse("type:dog");
        result = session.createFullTextQuery(query).setProjection( "type" ).list();
        assertEquals( "Enum projection works", 1, result.size() ); //the query is dumb because restrictive

    query = new TermQuery( new Term("clazz", Cloud.class.getName() ) );
        result = session.createFullTextQuery(query).setProjection( "clazz" ).list();
        assertEquals( "Clazz projection works", 1, result.size() );
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.