@Test(expected = RuntimeException.class) public void testPrepareQueryWithParseError() throws ParseException { ProjectionSearchRequestBuilderTestHelper sutSubclass = new ProjectionSearchRequestBuilderTestHelper(); final QueryParser queryParser = context.mock(QueryParser.class, "mockedQueryParser"); final String searchText = "foo now hey bar"; context.checking(new Expectations() { { one(queryParser).parse(searchText); will(throwException(new ParseException())); } }); sutSubclass.prepareQuery(queryParser, searchText); context.assertIsSatisfied(); }
protected org.hibernate.search.jpa.FullTextQuery prepareQuery(final QueryParser inQueryParser, final String nativeSearchString) { Query luceneQuery; try { luceneQuery = inQueryParser.parse(nativeSearchString); } catch (ParseException e) { String message = "Unable to parse query: '" + nativeSearchString + "'"; log.error(message); throw new RuntimeException(message); } if (log.isInfoEnabled()) { log.info("Lucene query: " + nativeSearchString); log.info("Lucene query parsed as: " + luceneQuery.toString()); log.info("Querying for objects of type: " + getEntityNames()); } FullTextEntityManager ftem = getFullTextEntityManager(); ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery( luceneQuery, resultTypes)); List<String> parameters = buildFieldList(); projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()])); projectionFullTextQuery.setResultTransformer(resultTransformer); return projectionFullTextQuery; }
ProjectionSearchRequestBuilder { protected org.hibernate.search.jpa.FullTextQuery prepareQuery(final QueryParser inQueryParser, final String nativeSearchString) { Query luceneQuery; try { luceneQuery = inQueryParser.parse(nativeSearchString); } catch (ParseException e) { String message = "Unable to parse query: '" + nativeSearchString + "'"; log.error(message); throw new RuntimeException(message); } if (log.isInfoEnabled()) { log.info("Lucene query: " + nativeSearchString); log.info("Lucene query parsed as: " + luceneQuery.toString()); log.info("Querying for objects of type: " + getEntityNames()); } FullTextEntityManager ftem = getFullTextEntityManager(); ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery( luceneQuery, resultTypes)); List<String> parameters = buildFieldList(); projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()])); projectionFullTextQuery.setResultTransformer(resultTransformer); return projectionFullTextQuery; } }
ProjectionSearchRequestBuilder { protected org.hibernate.search.jpa.FullTextQuery prepareQuery(final QueryParser inQueryParser, final String nativeSearchString) { Query luceneQuery; try { luceneQuery = inQueryParser.parse(nativeSearchString); } catch (ParseException e) { String message = "Unable to parse query: '" + nativeSearchString + "'"; log.error(message); throw new RuntimeException(message); } if (log.isInfoEnabled()) { log.info("Lucene query: " + nativeSearchString); log.info("Lucene query parsed as: " + luceneQuery.toString()); log.info("Querying for objects of type: " + getEntityNames()); } FullTextEntityManager ftem = getFullTextEntityManager(); ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery( luceneQuery, resultTypes)); List<String> parameters = buildFieldList(); projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()])); projectionFullTextQuery.setResultTransformer(resultTransformer); return projectionFullTextQuery; } ProjectionSearchRequestBuilder(); }
ProjectionSearchRequestBuilder { protected org.hibernate.search.jpa.FullTextQuery prepareQuery(final QueryParser inQueryParser, final String nativeSearchString) { Query luceneQuery; try { luceneQuery = inQueryParser.parse(nativeSearchString); } catch (ParseException e) { String message = "Unable to parse query: '" + nativeSearchString + "'"; log.error(message); throw new RuntimeException(message); } if (log.isInfoEnabled()) { log.info("Lucene query: " + nativeSearchString); log.info("Lucene query parsed as: " + luceneQuery.toString()); log.info("Querying for objects of type: " + getEntityNames()); } FullTextEntityManager ftem = getFullTextEntityManager(); ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery( luceneQuery, resultTypes)); List<String> parameters = buildFieldList(); projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()])); projectionFullTextQuery.setResultTransformer(resultTransformer); return projectionFullTextQuery; } ProjectionSearchRequestBuilder(); @PersistenceContext void setEntityManager(final EntityManager newEntityManager); org.hibernate.search.jpa.FullTextQuery buildQueryFromNativeSearchString(final String nativeSearchString); org.hibernate.search.jpa.FullTextQuery buildQueryFromSearchText(final String searchText); org.hibernate.search.jpa.FullTextQuery buildQueryFromSearchText(final String searchText,
            final String constraints); org.hibernate.search.jpa.FullTextQuery setPaging(final org.hibernate.search.jpa.FullTextQuery query,
            final int from, final int to); String escapeAllButWildcardCharacters(final String s); String escape(final String s); void setResultTypes(final Class< ? >[] theResultTypes); void setSearchStringFormat(final String theSearchStringFormat); void setResultTransformer(final ResultTransformer theResultTransformer); void setQueryParserBuilder(final QueryParserBuilder inQueryParserBuilder); void setResultFields(final List<String> theResultFields); void setAdvancedQueryParserBuilder(final QueryParserBuilder inAdvancedQueryParserBuilder); String getEntityNames(); }
ProjectionSearchRequestBuilder { protected org.hibernate.search.jpa.FullTextQuery prepareQuery(final QueryParser inQueryParser, final String nativeSearchString) { Query luceneQuery; try { luceneQuery = inQueryParser.parse(nativeSearchString); } catch (ParseException e) { String message = "Unable to parse query: '" + nativeSearchString + "'"; log.error(message); throw new RuntimeException(message); } if (log.isInfoEnabled()) { log.info("Lucene query: " + nativeSearchString); log.info("Lucene query parsed as: " + luceneQuery.toString()); log.info("Querying for objects of type: " + getEntityNames()); } FullTextEntityManager ftem = getFullTextEntityManager(); ProjectionFullTextQuery projectionFullTextQuery = new ProjectionFullTextQuery(ftem.createFullTextQuery( luceneQuery, resultTypes)); List<String> parameters = buildFieldList(); projectionFullTextQuery.setProjection(parameters.toArray(new String[parameters.size()])); projectionFullTextQuery.setResultTransformer(resultTransformer); return projectionFullTextQuery; } ProjectionSearchRequestBuilder(); @PersistenceContext void setEntityManager(final EntityManager newEntityManager); org.hibernate.search.jpa.FullTextQuery buildQueryFromNativeSearchString(final String nativeSearchString); org.hibernate.search.jpa.FullTextQuery buildQueryFromSearchText(final String searchText); org.hibernate.search.jpa.FullTextQuery buildQueryFromSearchText(final String searchText,
            final String constraints); org.hibernate.search.jpa.FullTextQuery setPaging(final org.hibernate.search.jpa.FullTextQuery query,
            final int from, final int to); String escapeAllButWildcardCharacters(final String s); String escape(final String s); void setResultTypes(final Class< ? >[] theResultTypes); void setSearchStringFormat(final String theSearchStringFormat); void setResultTransformer(final ResultTransformer theResultTransformer); void setQueryParserBuilder(final QueryParserBuilder inQueryParserBuilder); void setResultFields(final List<String> theResultFields); void setAdvancedQueryParserBuilder(final QueryParserBuilder inAdvancedQueryParserBuilder); String getEntityNames();  }