Package org.hibernate.search.jpa

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


          .createQuery());
    } else {
      booleanJunction.must(userQueryBuilder.all().createQuery());
    }
   
    return fullTextEntityManager.createFullTextQuery(booleanJunction.createQuery(), User.class);
  }
 
  @Override
  public List<ArtifactVersionNotification> listLastNotifications(User user, long limit) {
    JPAQuery query = new JPAQuery(getEntityManager());
View Full Code Here


  public <E extends Entity> List<E> search(Class<E> entityClass, String fieldList, String searchString)
  {
    FullTextEntityManager ftem = Search.getFullTextEntityManager(this.em);
    QueryBuilder qb = ftem.getSearchFactory().buildQueryBuilder().forEntity(entityClass).get();
    org.apache.lucene.search.Query query = qb.keyword().onFields(fieldList).matching(searchString).createQuery();
    javax.persistence.Query persistenceQuery = ftem.createFullTextQuery(query, entityClass);
    @SuppressWarnings("unchecked")
    List<E> result = persistenceQuery.getResultList();
    return result;
  }
}
View Full Code Here

  private List<Activity> searchQuestions(String fields, String searchTerm) {
    FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(getEntityManager());
    QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Question.class).get();
    org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(searchTerm).createQuery();
    javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Question.class);
    persistenceQuery.setMaxResults(10);
    return (List<Activity>) persistenceQuery.getResultList();
  }

  private List<Activity> searchWorkTasks(String fields, String searchTerm) {
View Full Code Here

  private List<Activity> searchWorkTasks(String fields, String searchTerm) {
    FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(getEntityManager());
    QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(WorkTask.class).get();
    org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(searchTerm).createQuery();
    javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, WorkTask.class);
    persistenceQuery.setMaxResults(10);
    return (List<Activity>) persistenceQuery.getResultList();
  }

  private List<Activity> searchToDos(String fields, String searchTerm) {
View Full Code Here

  private List<Activity> searchToDos(String fields, String searchTerm) {
    FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(getEntityManager());
    QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(ToDo.class).get();
    org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(searchTerm).createQuery();

    javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, ToDo.class);
    persistenceQuery.setMaxResults(10);
    return (List<Activity>) persistenceQuery.getResultList();
  }

  private List<Activity> searchStatus(String fields, String searchTerm) {
View Full Code Here

  private List<Activity> searchStatus(String fields, String searchTerm) {
    FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(getEntityManager());
    QueryBuilder qb = fullTextEntityManager.getSearchFactory().buildQueryBuilder().forEntity(Status.class).get();
    org.apache.lucene.search.Query query = qb.keyword().onFields(fields).matching(searchTerm).createQuery();
    javax.persistence.Query persistenceQuery = fullTextEntityManager.createFullTextQuery(query, Status.class);
    persistenceQuery.setMaxResults(10);
    return (List<Activity>) persistenceQuery.getResultList();
  }

  public List<Activity> searchQuestionsByTitle(String searchTerm) {
View Full Code Here

        // get the FullTextQuery
        FullTextEntityManager ftem = getFullTextEntityManager();

        // wrap the FullTextQuery so we have more control over the control flow
        ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery(
                luceneQuery, resultTypes));

        // set the result format to projection
        List<String> parameters = buildFieldList();
        projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()]));
View Full Code Here

            }

            String luceneQueryString = String.format(query.toString(), inRequest.getSearchString());
            org.apache.lucene.search.Query luceneQuery = parser.parse(luceneQueryString);

            FullTextQuery fullTextQuery = sessionEntityManager.createFullTextQuery(luceneQuery, inRequest
                    .getObjectType());

            fullTextQuery.setFirstResult(inRequest.getFirstResult());
            fullTextQuery.setMaxResults(inRequest.getMaxResults());
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

                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.