Package org.elasticsearch.index.query

Examples of org.elasticsearch.index.query.RangeQueryBuilder


    } //TESTED logic3* - end if entity options (apart from sentiment, which is handled below)
           
    // Sentiment... only apply for entities (association sentiment is handled in parseAssociationTerm)
   
    if ((null != qt.sentiment) && (EntityPojo.docQuery_index_ == sFieldName)) { // (note: can use pointers here)
      RangeQueryBuilder sentimentQ = QueryBuilders.rangeQuery(EntityPojo.docQuery_sentiment_);
      if (null != qt.sentiment.min) {
        sentimentQ.from(qt.sentiment.min);
      }
      if (null != qt.sentiment.max) {
        sentimentQ.to(qt.sentiment.max);         
      }
      if (null == termQ) {
        termQ = sentimentQ;
        sQueryTerm.append("sentiment:[").append(qt.sentiment.min).append(',').append(qt.sentiment.max).append(']');
      }
View Full Code Here


    if (null != sentiment) {
      if (!bFirstTerm) {
        sQueryTerm.append(" AND ");       
      }     
      bFirstTerm = false;
      RangeQueryBuilder sentimentQ = QueryBuilders.rangeQuery(AssociationPojo.docQuery_sentiment_);     
      if (null != sentiment.min) {
        sentimentQ.from(sentiment.min);
      }
      if (null != sentiment.max) {
        sentimentQ.to(sentiment.max);         
      }
      query.must(sentimentQ);
      sQueryTerm.append("sentiment:[").append(sentiment.min).append(',').append(sentiment.max).append(']');
    }//TOTEST (combined sentiment only)
    sQueryTerm.append(')');
View Full Code Here

        qb.setQuery(QueryBuilders.filteredQuery(QueryBuilders.matchAllQuery(), FilterBuilders.termFilter(TERM, term)));
        client.deleteByQuery(qb.request());
    }

    public void deleteOlderThan(int hours) {
        RangeQueryBuilder sqb = QueryBuilders.rangeQuery(LAST_REQ).lt(new MyDate().minusHours(hours).toDate());
        DeleteByQueryRequestBuilder dbq = client.prepareDeleteByQuery(getIndexName()).setQuery(sqb);
        client.deleteByQuery(dbq.request());
    }
View Full Code Here

    // Recency boost. We differentiate between various (random) levels of
    // recency
    if (recencyBoost) {
      Calendar date = Calendar.getInstance();
      // Last week
      RangeQueryBuilder rangeQueryBuilder = QueryBuilders.rangeQuery(MODIFIED);
      date.add(Calendar.WEEK_OF_YEAR, -1);
      rangeQueryBuilder.gt(date.getTimeInMillis()).boost(10);
      booleanQuery.should(rangeQueryBuilder);
      // Last month
      rangeQueryBuilder = QueryBuilders.rangeQuery(MODIFIED);
      date.add(Calendar.WEEK_OF_YEAR, -3);
      rangeQueryBuilder.gt(date.getTimeInMillis()).boost(5);
      booleanQuery.should(rangeQueryBuilder);
      // Last year
      rangeQueryBuilder = QueryBuilders.rangeQuery(MODIFIED);
      date.add(Calendar.MONTH, -5);
      rangeQueryBuilder.gt(date.getTimeInMillis()).boost(2);
      booleanQuery.should(rangeQueryBuilder);
    }

    QueryBuilder unfilteredQuery = queryBuilder;
    List<FilterBuilder> filters = new ArrayList<FilterBuilder>();
View Full Code Here

     * Returns the range query that is represented by this date range.
     *
     * @return the range query builder
     */
    QueryBuilder getQueryBuilder() {
      RangeQueryBuilder rqb = new RangeQueryBuilder(field);
      if (startDate != null)
        rqb.from(startDate.getTime());
      if (endDate != null)
        rqb.to(endDate.getTime());
      return rqb;
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.index.query.RangeQueryBuilder

Copyright © 2018 www.massapicom. 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.