Package org.apache.lucene.queryparser.xml

Examples of org.apache.lucene.queryparser.xml.ParserException


      } else {
        if (("should".equalsIgnoreCase(occs)) || ("".equals(occs))) {
          occurs = BooleanClause.Occur.SHOULD;
        } else {
          if (occs != null) {
            throw new ParserException("Invalid value for \"occurs\" attribute of clause:" + occs);
          }
        }
      }
    }
    return occurs;
View Full Code Here


    if (keepMode.equalsIgnoreCase("first")) {
      df.setKeepMode(DuplicateFilter.KeepMode.KM_USE_FIRST_OCCURRENCE);
    } else if (keepMode.equalsIgnoreCase("last")) {
      df.setKeepMode(DuplicateFilter.KeepMode.KM_USE_LAST_OCCURRENCE);
    } else {
      throw new ParserException("Illegal keepMode attribute in DuplicateFilter:" + keepMode);
    }

    String processingMode = DOMUtils.getAttribute(e, "processingMode", "full");
    if (processingMode.equalsIgnoreCase("full")) {
      df.setProcessingMode(DuplicateFilter.ProcessingMode.PM_FULL_VALIDATION);
    } else if (processingMode.equalsIgnoreCase("fast")) {
      df.setProcessingMode(DuplicateFilter.ProcessingMode.PM_FAST_INVALIDATION);
    } else {
      throw new ParserException("Illegal processingMode attribute in DuplicateFilter:" + processingMode);
    }

    return df;
  }
View Full Code Here

      SpanOrQuery soq = new SpanOrQuery(clausesList.toArray(new SpanQuery[clausesList.size()]));
      soq.setBoost(DOMUtils.getAttribute(e, "boost", 1.0f));
      return soq;
    }
    catch (IOException ioe) {
      throw new ParserException("IOException parsing value:" + value);
    } finally {
      IOUtils.closeWhileHandlingException(ts);
    }
  }
View Full Code Here

  @Override
  public SpanQuery getSpanQuery(Element e) throws ParserException {
    SpanQueryBuilder builder = builders.get(e.getNodeName());
    if (builder == null) {
      throw new ParserException("No SpanQueryObjectBuilder defined for node " + e.getNodeName());
    }
    return builder.getSpanQuery(e);
  }
View Full Code Here

      } else if (type.equalsIgnoreCase("float")) {
        filter = NumericRangeFilter.newFloatRange(field, precisionStep, Float
            .valueOf(lowerTerm), Float.valueOf(upperTerm), lowerInclusive,
            upperInclusive);
      } else {
        throw new ParserException("type attribute must be one of: [long, int, double, float]");
      }
      return filter;
    } catch (NumberFormatException nfe) {
      if (strictMode) {
        throw new ParserException("Could not parse lowerTerm or upperTerm into a number", nfe);
      }
      return NO_MATCH_FILTER;
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryparser.xml.ParserException

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.