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

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

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

origin: org.hibernate.hql/hibernate-hql-lucene

  @Override
  protected Query getStrictlyGreaterQuery() {
    return matchingContextSupport.rangeMatchingContext().above( value ).excludeLimit().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 getStrictlyLessQuery() {
  return matchingContextSupport.rangeMatchingContext().below( value ).excludeLimit().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: hibernate/hibernate-search

@Test
public void testRangeQueryFromTo() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  calendar.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
  calendar.set( 1900, 2, 12, 0, 0, 0 );
  calendar.set( Calendar.MILLISECOND, 0 );
  Date from = calendar.getTime();
  calendar.set( 1910, 2, 12, 0, 0, 0 );
  Date to = calendar.getTime();
  Query query = monthQb
      .range()
        .onField( "estimatedCreation" )
        .andField( "justfortest" )
          .ignoreFieldBridge().ignoreAnalyzer()
        .from( from )
        .to( to ).excludeLimit()
        .createQuery();
  helper.assertThat( query ).from( Month.class ).hasResultSize( 1 );
}
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: hibernate/hibernate-search

@Test
@Category(SkipOnElasticsearch.class) // This only works because of a Lucene-specific hack in org.hibernate.search.bridge.util.impl.NumericFieldUtils.createNumericRangeQuery
public void testRangeQueryFromToIgnoreFieldBridge() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  calendar.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
  calendar.set( 1900, 2, 12, 0, 0, 0 );
  calendar.set( Calendar.MILLISECOND, 0 );
  Date from = calendar.getTime();
  calendar.set( 1910, 2, 12, 0, 0, 0 );
  Date to = calendar.getTime();
  Query query = monthQb
      .range()
        .onField( "estimatedCreation" )
          .ignoreFieldBridge()
        .andField( "justfortest" )
          .ignoreFieldBridge().ignoreAnalyzer()
        .from( DateTools.round( from, DateTools.Resolution.MINUTE ) )
        .to( DateTools.round( to, DateTools.Resolution.MINUTE ) )
          .excludeLimit()
        .createQuery();
  helper.assertThat( query ).from( Month.class ).hasResultSize( 1 );
}
origin: org.hibernate.hql/hibernate-hql-lucene

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

@Override
public Query visit(FullTextRangeExpr fullTextRangeExpr) {
 PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextRangeExpr.getChild();
 //todo [anistor] incomplete implementation ?
 if (fullTextRangeExpr.getLower() == null && fullTextRangeExpr.getUpper() == null) {
   return new TermRangeQuery(propertyValueExpr.getPropertyPath().asStringPath(), null, null, fullTextRangeExpr.isIncludeLower(), fullTextRangeExpr.isIncludeUpper());
 }
 RangeMatchingContext rangeMatchingContext = applyFieldBridge(true, propertyValueExpr.getPropertyPath(), queryBuilder.range().onField(propertyValueExpr.getPropertyPath().asStringPath()));
 RangeTerminationExcludable t = null;
 if (fullTextRangeExpr.getLower() != null) {
   t = rangeMatchingContext.above(fullTextRangeExpr.getLower());
   if (!fullTextRangeExpr.isIncludeLower()) {
    t.excludeLimit();
   }
 }
 if (fullTextRangeExpr.getUpper() != null) {
   t = rangeMatchingContext.below(fullTextRangeExpr.getUpper());
   if (!fullTextRangeExpr.isIncludeUpper()) {
    t.excludeLimit();
   }
 }
 return t.createQuery();
}
origin: org.hibernate.hql/hibernate-hql-lucene

@Override
protected Query getGreaterOrEqualsQuery() {
  return matchingContextSupport.rangeMatchingContext().above( value ).createQuery();
}
origin: org.infinispan/infinispan-embedded-query

@Override
public Query visit(FullTextRangeExpr fullTextRangeExpr) {
 PropertyValueExpr propertyValueExpr = (PropertyValueExpr) fullTextRangeExpr.getChild();
 //todo [anistor] incomplete implementation ?
 if (fullTextRangeExpr.getLower() == null && fullTextRangeExpr.getUpper() == null) {
   return new TermRangeQuery(propertyValueExpr.getPropertyPath().asStringPath(), null, null, fullTextRangeExpr.isIncludeLower(), fullTextRangeExpr.isIncludeUpper());
 }
 RangeMatchingContext rangeMatchingContext = applyFieldBridge(true, propertyValueExpr.getPropertyPath(), queryBuilder.range().onField(propertyValueExpr.getPropertyPath().asStringPath()));
 RangeTerminationExcludable t = null;
 if (fullTextRangeExpr.getLower() != null) {
   t = rangeMatchingContext.above(fullTextRangeExpr.getLower());
   if (!fullTextRangeExpr.isIncludeLower()) {
    t.excludeLimit();
   }
 }
 if (fullTextRangeExpr.getUpper() != null) {
   t = rangeMatchingContext.below(fullTextRangeExpr.getUpper());
   if (!fullTextRangeExpr.isIncludeUpper()) {
    t.excludeLimit();
   }
 }
 return t.createQuery();
}
origin: org.hibernate.hql/hibernate-hql-lucene

  @Override
  public Query getQuery() {
    return matchingContextSupport.rangeMatchingContext().from( lower ).to( upper ).createQuery();
  }
}
origin: org.infinispan/infinispan-query

public void testQueryingRangeBelowExcludingLimit() throws ParseException {
 loadTestingData();
 Query query = Search.getSearchManager(cache).buildQueryBuilderForClass(Person.class)
    .get().range().onField("age").below(30).excludeLimit().createQuery();
 CacheQuery<?> cacheQuery = Search.getSearchManager(cache).getQuery(query);
 List<?> found = cacheQuery.list();
 assertEquals(2, found.size());
 assert found.contains(person1);
 assert found.contains(person3);
 assert !found.contains(person4) : "This should not contain object person4";
 person4 = new Person();
 person4.setName("Mighty Goat");
 person4.setBlurb("Also eats grass");
 person4.setAge(28);
 cache.put("mighty", person4);
 cacheQuery = Search.getSearchManager(cache).getQuery(query);
 found = cacheQuery.list();
 assert found.size() == 3 : "Size of list should be 3";
 assert found.contains(person1);
 assert found.contains(person3);
 assert found.contains(person4) : "This should now contain object person4";
}
origin: hibernate/hibernate-search

@Test
public void testRangeQueryAbove() throws Exception {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  calendar.setTimeZone( TimeZone.getTimeZone( "UTC" ) );
  calendar.set( 10 + 1900, 2, 12, 0, 0, 0 );
  Date to = calendar.getTime();
  Query query = monthQb
      .range()
        .onField( "estimatedCreation" )
        .andField( "justfortest" )
          .ignoreFieldBridge().ignoreAnalyzer()
        .above( to )
        .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
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-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 );
}
origin: org.infinispan/infinispan-query

public void testQueryingRangeBelowWithLimit() throws ParseException {
 loadTestingData();
 Query query = Search.getSearchManager(cache).buildQueryBuilderForClass(Person.class)
    .get().range().onField("age").below(30).createQuery();
 CacheQuery<?> cacheQuery = Search.getSearchManager(cache).getQuery(query);
 List<?> found = cacheQuery.list();
 assertEquals(3, found.size());
 assert found.contains(person1);
 assert found.contains(person2);
 assert found.contains(person3);
 assert !found.contains(person4) : "This should not contain object person4";
 person4 = new Person();
 person4.setName("Mighty Goat");
 person4.setBlurb("Also eats grass");
 person4.setAge(28);
 cache.put("mighty", person4);
 cacheQuery = Search.getSearchManager(cache).getQuery(query);
 found = cacheQuery.list();
 assert found.size() == 4 : "Size of list should be 4";
 assert found.contains(person1);
 assert found.contains(person2);
 assert found.contains(person3);
 assert found.contains(person4) : "This should now contain object person4";
}
origin: hibernate/hibernate-search

@Test
@TestForIssue( jiraKey = "HSEARCH-1378")
public void testNumericRangeQueryAbove() {
  final QueryBuilder monthQb = helper.queryBuilder( Month.class );
  //inclusive
  Query query = monthQb
      .range()
        .onField( "raindropInMm" )
        .above( 0.231d )
        .createQuery();
  assertTrue( query.getClass().isAssignableFrom( NumericRangeQuery.class ) );
  helper.assertThat( query ).from( Month.class ).matchesUnorderedIds( 1, 2, 3 );
  //exclusive
  query = monthQb
      .range()
        .onField( "raindropInMm" )
        .above( 0.231d )
        .excludeLimit()
        .createQuery();
  helper.assertThat( query ).from( Month.class ).matchesUnorderedIds( 2, 3 );
}
org.hibernate.search.query.dslRangeTerminationExcludable

Most used methods

  • createQuery
  • excludeLimit

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JComboBox (javax.swing)
  • Top Sublime Text plugins
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