Package org.apache.solr.util

Examples of org.apache.solr.util.DateMathParser.parseMath()


              "tdouble", String.valueOf(i * 2.33d),
              "tdate", d));
    }
    for (int i = 0; i < 5; i++) {
      long l = Integer.MAX_VALUE + i*1L;
      String d = format.format(i == 0 ? dmp.parseMath("/DAY") : dmp.parseMath("/DAY+" + i + "DAYS"));
      assertU(adoc("id", String.valueOf((i+1)*10), "tint", String.valueOf(i),
              "tlong", String.valueOf(l),
              "tfloat", String.valueOf(i * i * 31.11f),
              "tdouble", String.valueOf(i * 2.33d),
              "tdate", d));
View Full Code Here


              "tdouble", String.valueOf(i * 2.33d),
              "tdate", d));
    }
    for (int i = 0; i < 5; i++) {
      long l = Integer.MAX_VALUE + i*1L;
      String d = format.format(i == 0 ? dmp.parseMath("/DAY") : dmp.parseMath("/DAY+" + i + "DAYS"));
      assertU(adoc("id", String.valueOf((i+1)*10), "tint", String.valueOf(i),
              "tlong", String.valueOf(l),
              "tfloat", String.valueOf(i * i * 31.11f),
              "tdouble", String.valueOf(i * 2.33d),
              "tdate", d));
View Full Code Here

    testFacetField(req, "tfloat", String.valueOf(31.11f), "2");
    testFacetField(req, "tfloat", String.valueOf(5*5*31.11f), "1");
    testFacetField(req, "tdouble", String.valueOf(2.33d), "2");
    testFacetField(req, "tdouble", String.valueOf(5*2.33d), "1");

    testFacetDate(req, "tdate", format.format(dmp.parseMath("/DAY")), "4");
    testFacetDate(req, "tdate", format.format(dmp.parseMath("/DAY+5DAYS")), "2");
  }

  private void checkPrecisionSteps(String fieldType) {
    FieldType type = h.getCore().getSchema().getFieldType(fieldType);
View Full Code Here

    testFacetField(req, "tfloat", String.valueOf(5*5*31.11f), "1");
    testFacetField(req, "tdouble", String.valueOf(2.33d), "2");
    testFacetField(req, "tdouble", String.valueOf(5*2.33d), "1");

    testFacetDate(req, "tdate", format.format(dmp.parseMath("/DAY")), "4");
    testFacetDate(req, "tdate", format.format(dmp.parseMath("/DAY+5DAYS")), "2");
  }

  private void checkPrecisionSteps(String fieldType) {
    FieldType type = h.getCore().getSchema().getFieldType(fieldType);
    if (type instanceof TrieField) {
View Full Code Here

    if (null == math || math.equals("")) {
      return p.getNow();
    }
   
    try {
      return p.parseMath(math);
    } catch (ParseException e) {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
                               "Invalid Date Math String:'" +val+'\'',e);
    }
  }
View Full Code Here

    if (null == math || math.equals("")) {
      return p.getNow();
    }
   
    try {
      return p.parseMath(math);
    } catch (ParseException e) {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
                               "Invalid Date Math String:'" +val+'\'',e);
    }
  }
View Full Code Here

                Date low = start;
                while (low.before(end)) {
                    dmp.setNow(low);
                    final String lowI = JahiaQueryParser.DATE_TYPE.toInternal(low);
                    final String label = JahiaQueryParser.DATE_TYPE.indexedToReadable(lowI, true);
                    Date high = dmp.parseMath(gap);
                    if (end.before(high)) {
                        if (params.getFieldBool(f, FacetParams.FACET_DATE_HARD_END,
                                false)) {
                            high = end;
                        } else {
View Full Code Here

    if (null == math || math.equals("")) {
      return p.getNow();
    }
   
    try {
      return p.parseMath(math);
    } catch (ParseException e) {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
                               "Invalid Date Math String:'" +val+'\'',e);
    }
  }
View Full Code Here

    if (null == math || math.equals("")) {
      return p.getNow();
    }

    try {
      return p.parseMath(math);
    } catch (ParseException e) {
      throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,
                               "Invalid Date Math String:'" +val+'\'',e);
    }
  }
View Full Code Here

        // delete anything too old, regardless of other policies
        try {
          if (maxCommitAge != null) {
            if (maxCommitAgeTimeStamp==-1) {
              DateMathParser dmp = new DateMathParser(DateField.UTC, Locale.US);
              maxCommitAgeTimeStamp = dmp.parseMath(maxCommitAge).getTime();
            }
            if (commit.getTimestamp() < maxCommitAgeTimeStamp) {
              commit.delete();
              continue;
            }
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.