Package org.hibernate.search.jpa

Examples of org.hibernate.search.jpa.FullTextEntityManager.createFullTextQuery()


    );

    org.apache.lucene.search.Query luceneQuery;
    luceneQuery = parser.parse( searchQuery );

    final FullTextQuery query = ftEm.createFullTextQuery( luceneQuery, Book.class );

    return query;
  }
}
View Full Code Here


    );

    org.apache.lucene.search.Query luceneQuery;
    luceneQuery = parser.parse( searchQuery );

    final FullTextQuery query = ftEm.createFullTextQuery( luceneQuery, Book.class );

    return query;
  }
}
View Full Code Here

   }

   public List<Book> findByKeyword(String keyword) {
      FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);
      TermQuery termQuery = new TermQuery(new Term("title", keyword));
      FullTextQuery fullTextQuery = fullTextEntityManager.createFullTextQuery(termQuery, Book.class);
      return fullTextQuery.getResultList();
   }

}
View Full Code Here

    em.getTransaction().commit();
    em.clear();
    em.getTransaction().begin();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );
    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
View Full Code Here

    em.getTransaction().begin();
    QueryParser parser = new QueryParser( "title", new StopAnalyzer() );
    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();
View Full Code Here

    Query query = parser.parse( "saltQty:noword" );
    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();

    em.clear();
View Full Code Here

    assertEquals( 0, em.createFullTextQuery( query ).getResultList().size() );
    query = new TermQuery( new Term("saltQty", "23.0") );
    assertEquals( "getResultList", 1, em.createFullTextQuery( query ).getResultList().size() );
    assertEquals( "getSingleResult and object retrieval", 23f,
        ( (Bretzelem.createFullTextQuery( query ).getSingleResult() ).getSaltQty() );
    assertEquals( 1, em.createFullTextQuery( query ).getResultSize() );
    em.getTransaction().commit();

    em.clear();

    em.getTransaction().begin();
View Full Code Here

                .keyword()
                .onFields("title", "text", "comments.text")
                .matching(filter)
                .createQuery();

        Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Question.class);
        return persistenceQuery.getResultList();
    }

    @Override
    public Account saveAccount(Account account) {
View Full Code Here

        BooleanQuery rootQuery = new BooleanQuery();
        rootQuery.add(new BooleanClause(guestQuery, Occur.MUST));
        rootQuery.add(new BooleanClause(termsQuery, Occur.MUST));

        // wrap Lucene query in a javax.persistence.Query
        Query persistenceQuery = fullTextEntityManager.createFullTextQuery(
                rootQuery, AbstractFacet.class);

        persistenceQuery.setMaxResults(100);

        // execute search
View Full Code Here

                boostPerField);

        org.apache.lucene.search.Query luceneQuery;
        luceneQuery = parser.parse(searchQuery);

        final FullTextQuery query = ftEm.createFullTextQuery(luceneQuery, Book.class);

        return query;
    }

}
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.