Tabnine Logo
RangeTerminationExcludable.createQuery
Code IndexAdd Tabnine to your IDE (free)

How to use
createQuery
method
in
org.hibernate.search.query.dsl.RangeTerminationExcludable

Best Java code snippets using org.hibernate.search.query.dsl.RangeTerminationExcludable.createQuery (Showing top 20 results out of 315)

origin: sanluan/PublicCMS

    .must(new TermQuery(new Term("siteId", siteId.toString())));
if (null != startPublishDate) {
  termination.must(queryBuilder.range().onField("publishDate").above(startPublishDate).createQuery());
  termination.must(queryBuilder.range().onField("publishDate").below(endPublishDate).createQuery());
origin: sanluan/PublicCMS

    .must(new TermQuery(new Term("siteId", siteId.toString())));
if (null != startPublishDate) {
  termination.must(queryBuilder.range().onField("publishDate").above(startPublishDate).createQuery());
  termination.must(queryBuilder.range().onField("publishDate").below(endPublishDate).createQuery());
origin: sanluan/PublicCMS

    .must(new TermQuery(new Term("siteId", siteId.toString())));
if (null != startPublishDate) {
  termination.must(queryBuilder.range().onField("publishDate").above(startPublishDate).createQuery());
  termination.must(queryBuilder.range().onField("publishDate").below(endPublishDate).createQuery());
origin: sanluan/PublicCMS

    .must(new TermQuery(new Term("siteId", siteId.toString())));
if (null != startPublishDate) {
  termination.must(queryBuilder.range().onField("publishDate").above(startPublishDate).createQuery());
  termination.must(queryBuilder.range().onField("publishDate").below(endPublishDate).createQuery());
origin: org.hibernate.hql/hibernate-hql-lucene

@Override
protected Query getLessOrEqualsQuery() {
  return matchingContextSupport.rangeMatchingContext().below( value ).createQuery();
}
origin: org.hibernate.hql/hibernate-hql-lucene

  @Override
  protected Query getStrictlyGreaterQuery() {
    return matchingContextSupport.rangeMatchingContext().above( value ).excludeLimit().createQuery();
  }
}
origin: hibernate/hibernate-search

@Test
public void testNumericRangeQueries() {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  Query query = monthQb
      .range()
        .onField( "raindropInMm" )
        .from( 0.23d )
        .to( 0.24d )
        .createQuery();
  assertTrue( query.getClass().isAssignableFrom( NumericRangeQuery.class ) );
  helper.assertThat( query ).from( Month.class ).matchesExactlyIds( 1 );
}
origin: hibernate/hibernate-search

@Test
@TestForIssue(jiraKey = "HSEARCH-1791")
public void testUsingRangeQueryOnNumericDocumentIdGeneratesTermRangeQuery() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  Query query = monthQb.range()
      .onField( "id" )
      .from( 1 )
      .to( 3 )
      .createQuery();
  assertTrue(
      "A string based TermQuery is expected, but got a " + query.getClass(), query instanceof TermRangeQuery
  );
}
origin: hibernate/hibernate-search

@Test
@TestForIssue(jiraKey = "HSEARCH-2070")
public void testSearchDateWithoutFieldBridge() throws Exception {
  QueryBuilder qb = helper.queryBuilder( ContainerEntity.class );
  Query q = qb.range().onField( "emb.date" )
      .above( initCalendar( 2007, Calendar.JANUARY, 14 ).getTime() )
      .createQuery();
  assertQuery( q ).matchesExactlyIds( 1L );
}
origin: org.infinispan/infinispan-query

@Override
public Query visit(BetweenExpr betweenExpr) {
 PropertyValueExpr propertyValueExpr = (PropertyValueExpr) betweenExpr.getLeftChild();
 ConstantValueExpr fromValueExpr = (ConstantValueExpr) betweenExpr.getFromChild();
 ConstantValueExpr toValueExpr = (ConstantValueExpr) betweenExpr.getToChild();
 Comparable fromValue = fromValueExpr.getConstantValueAs(propertyValueExpr.getPrimitiveType(), namedParameters);
 Comparable toValue = toValueExpr.getConstantValueAs(propertyValueExpr.getPrimitiveType(), namedParameters);
 return applyFieldBridge(false, propertyValueExpr.getPropertyPath(), queryBuilder.range().onField(propertyValueExpr.getPropertyPath().asStringPath()))
    .from(fromValue).to(toValue).createQuery();
}
origin: org.infinispan/infinispan-embedded-query

@Override
public Query visit(BetweenExpr betweenExpr) {
 PropertyValueExpr propertyValueExpr = (PropertyValueExpr) betweenExpr.getLeftChild();
 ConstantValueExpr fromValueExpr = (ConstantValueExpr) betweenExpr.getFromChild();
 ConstantValueExpr toValueExpr = (ConstantValueExpr) betweenExpr.getToChild();
 Comparable fromValue = fromValueExpr.getConstantValueAs(propertyValueExpr.getPrimitiveType(), namedParameters);
 Comparable toValue = toValueExpr.getConstantValueAs(propertyValueExpr.getPrimitiveType(), namedParameters);
 return applyFieldBridge(false, propertyValueExpr.getPropertyPath(), queryBuilder.range().onField(propertyValueExpr.getPropertyPath().asStringPath()))
    .from(fromValue).to(toValue).createQuery();
}
origin: org.infinispan/infinispan-query

private List<Object> getYoungerThan(SearchManager sm, int age) {
 QueryBuilder queryBuilder = sm.buildQueryBuilderForClass(Person.class).get();
 Query query = queryBuilder.range().onField("age").below(age).createQuery();
 return sm.getQuery(query, Person.class).list();
}
origin: hibernate/hibernate-search

private Query queryForRangeOnFieldSorted(int min, int max, String fieldName) {
  ExtendedSearchIntegrator integrator = factoryHolder.getSearchFactory();
  QueryBuilder queryBuilder = integrator.buildQueryBuilder().forEntity( Person.class ).get();
  return queryBuilder
      .range()
      .onField( fieldName )
      .from( min )
      .to( max )
      .createQuery();
}
origin: hibernate/hibernate-search

@SuppressWarnings("unchecked")
private List<ArrayBridgeTestEntity> findResultsWithRangeQuery(String fieldName, Object start) {
  QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder()
      .forEntity( ArrayBridgeTestEntity.class ).get();
  Query query = queryBuilder.range().onField( fieldName ).above( start ).createQuery();
  return fullTextSession.createFullTextQuery( query, ArrayBridgeTestEntity.class ).list();
}
origin: hibernate/hibernate-search

@SuppressWarnings("unchecked")
private List<IterableBridgeTestEntity> findResultsWithRangeQuery(String fieldName, Object start) {
  QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder()
      .forEntity( IterableBridgeTestEntity.class ).get();
  Query query = queryBuilder.range().onField( fieldName ).above( start ).createQuery();
  return fullTextSession.createFullTextQuery( query, IterableBridgeTestEntity.class ).list();
}
origin: hibernate/hibernate-search

@SuppressWarnings("unchecked")
private List<MapBridgeTestEntity> findResultsWithRangeQuery(String fieldName, Object start) {
  QueryBuilder queryBuilder = fullTextSession.getSearchFactory().buildQueryBuilder()
      .forEntity( MapBridgeTestEntity.class ).get();
  Query query = queryBuilder.range().onField( fieldName ).above( start ).createQuery();
  return fullTextSession.createFullTextQuery( query, MapBridgeTestEntity.class ).list();
}
origin: org.infinispan/infinispan-query

public void testBooleanQueriesOnMultipleTables() throws ParseException {
 loadTestingData();
 AnotherGrassEater anotherGrassEater = new AnotherGrassEater("Another grass-eater", "Eats grass");
 cache.put("key4", anotherGrassEater);
 Query subQuery = Search.getSearchManager(cache).buildQueryBuilderForClass(Person.class).get().range()
    .onField("age").below(20).createQuery();
 Query query = Search.getSearchManager(cache).buildQueryBuilderForClass(AnotherGrassEater.class).get().bool()
    .should(createQueryParser("name").parse("grass")).should(subQuery).createQuery();
 CacheQuery<Person> cacheQuery = Search.getSearchManager(cache).getQuery(query);
 List<Person> found = cacheQuery.list();
 assertEquals(2, found.size());
 assert found.contains(person1);
 assert found.contains(anotherGrassEater);
}
origin: hibernate/hibernate-search

@Test
public void testRangeQueryAboveInclusive() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  // test the limits, inclusive
  Query query = monthQb
      .range()
        .onField( "estimatedCreation" )
        .andField( "justfortest" )
          .ignoreFieldBridge().ignoreAnalyzer()
        .above( february )
        .createQuery();
  helper.assertThat( query ).from( Month.class ).matchesExactlyIds( 2 );
}
origin: hibernate/hibernate-search

@Test
public void verifyExplicitRangeQuery() {
  Query query = getQueryBuilder()
        .range()
          .onField( "age" )
          .from( 1 ).excludeLimit()
          .to( 3 ).excludeLimit()
          .createQuery();
  Assert.assertTrue( query instanceof NumericRangeQuery );
  assertProjection( query, "title" ).matchesExactlySingleProjections( "title-two" );
}
origin: hibernate/hibernate-search

@Test
@TestForIssue(jiraKey = "HSEARCH-2656")
public void testNumericRangeQueryWithFieldTypeOverriddenByFieldBridge() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  Query query = monthQb
      .range()
        .onField( "monthBase0" )
          .ignoreFieldBridge().ignoreAnalyzer()
        .below( 1 ).excludeLimit()
        .createQuery();
  helper.assertThat( query ).from( Month.class ).matchesUnorderedIds( 1 );
}
org.hibernate.search.query.dslRangeTerminationExcludablecreateQuery

Popular methods of RangeTerminationExcludable

  • excludeLimit

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now