Package org.sindice.siren.analysis

Examples of org.sindice.siren.analysis.NumericAnalyzer$NumericParser


      final Map<String, Analyzer> dts = this.getQueryConfigHandler().get(KeywordConfigurationKeys.DATATYPES_ANALYZERS);
      final Analyzer analyzer = dts.get(node.getTag(DatatypeQueryNode.DATATYPE_TAGID));

      if (analyzer instanceof NumericAnalyzer) {
        final NumericAnalyzer na = (NumericAnalyzer) analyzer;

        final FieldQueryNode lower = termRangeNode.getLowerBound();
        final FieldQueryNode upper = termRangeNode.getUpperBound();

        final char[] lowerText = lower.getTextAsString().toCharArray();
        final char[] upperText = upper.getTextAsString().toCharArray();

        final NumericParser<?> parser = na.getNumericParser();
        final Number lowerNumber;
        try {
          if (lowerText.length == 0) { // open bound
            lowerNumber = null;
          } else {
View Full Code Here


      final Map<String, Analyzer> dts = this.getQueryConfigHandler().get(KeywordConfigurationKeys.DATATYPES_ANALYZERS);
      final Analyzer analyzer = dts.get(node.getTag(DatatypeQueryNode.DATATYPE_TAGID));

      if (analyzer instanceof NumericAnalyzer) {
        final NumericAnalyzer na = (NumericAnalyzer) analyzer;
        final char[] text = fieldNode.getTextAsString().toCharArray();
        final ReusableCharArrayReader textReader = new ReusableCharArrayReader(text);
        final Number number;
        try {
          number = na.getNumericParser().parse(textReader);
        } catch (final Exception e) {
          throw new QueryNodeParseException(new MessageImpl(QueryParserMessages.COULD_NOT_PARSE_NUMBER, text), e);
        }

        final CharSequence field = fieldNode.getField();
View Full Code Here

    }
    else {
      upperNumber = null;
    }

    final NumericAnalyzer numericAnalyzer = numericRangeNode.getNumericAnalyzer();
    final NumericType numberType = numericRangeNode.getNumericType();
    final String field = numericRangeNode.getField().toString();
    final boolean minInclusive = numericRangeNode.isLowerInclusive();
    final boolean maxInclusive = numericRangeNode.isUpperInclusive();
    final int precisionStep = numericAnalyzer.getPrecisionStep();

    switch (numberType) {
      case LONG:
        return NodeNumericRangeQuery.newLongRange(field, precisionStep,
          (Long) lowerNumber, (Long) upperNumber, minInclusive, maxInclusive);
View Full Code Here

TOP

Related Classes of org.sindice.siren.analysis.NumericAnalyzer$NumericParser

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.