Package org.apache.lucene.queryparser.classic

Examples of org.apache.lucene.queryparser.classic.ParseException


  throws ParseException {
    final Map<String, Float> queryFields = SolrPluginUtils.parseFieldBoosts(solrParams.getParams(SirenParams.QF));
    if (queryFields.isEmpty()) {
      final String df = QueryParsing.getDefaultField(indexSchema, solrParams.get(CommonParams.DF));
      if (df == null) {
        throw new ParseException("Neither "+SirenParams.QF+", "+CommonParams.DF +", nor the default search field are present.");
      }
      queryFields.put(df, 1.0f);
    }
    checkFieldTypes(indexSchema, queryFields);
    return queryFields;
View Full Code Here


        LOG.debug("Parseable sub query [{0}]", superQueryStr);
        String key = _prefixToSub + _subQueryIndex;
        QueryParser newParser = getNewParser();
        Query query = newParser.parse(superQueryStr);
        if (!isSameGroupName(query)) {
          throw new ParseException("Super query [" + superQueryStr + "] cannot reference more than one column family.");
        }
        if (_superSearch) {
          query = newSuperQuery(query);
        } else {
          query = wrapFilter(query);
View Full Code Here

      if (c == '<') {
        if (p != '\\') {
          if (start == -1) {
            start = i;
          } else {
            throw new ParseException("Cannot parse '" + source + "': Encountered \"<\" at line " + line + ", column "
                + column + ".");
          }
        }
      } else if (c == '>') {
        if (p != '\\') {
          if (start != -1) {
            group.match(start, i + 1);
            start = -1;
          } else {
            throw new ParseException("Cannot parse '" + source + "': Encountered \">\" at line " + line + ", column "
                + column + ".");
          }
        }
      } else if (c == '\n') {
        line++;
View Full Code Here

          userAccessTokens = getAccessTokens(authenticatedUserName);
        }
        catch (IOException e)
        {
          LOG.error("IO exception communicating with MCF authority service: "+e.getMessage(),e);
          throw new ParseException("IO exception communicating with MCF authority service: "+e.getMessage());
        }
      }

      BooleanQuery bq = new BooleanQuery();
      //bf.setMaxClauseCount(100000);
View Full Code Here

  // Helper method used to report on any clauses that appear in query syntax
  private void checkPhraseClauseIsForSameField(String field)
      throws ParseException {
    if (!field.equals(currentPhraseQuery.field)) {
      throw new ParseException("Cannot have clause for field \"" + field
          + "\" nested in phrase " + " for field \"" + currentPhraseQuery.field
          + "\"");
    }
  }
View Full Code Here

        LOG.debug("Parseable sub query [{0}]", superQueryStr);
        String key = _prefixToSub + _subQueryIndex;
        QueryParser newParser = getNewParser();
        Query query = newParser.parse(superQueryStr);
        if (!isSameGroupName(query)) {
          throw new ParseException("Super query [" + superQueryStr + "] cannot reference more than one column family.");
        }
        if (_superSearch) {
          query = newSuperQuery(query);
        } else {
          query = wrapFilter(query);
View Full Code Here

      if (c == '<') {
        if (p != '\\') {
          if (start == -1) {
            start = i;
          } else {
            throw new ParseException("Cannot parse '" + source + "': Encountered \"<\" at line " + line + ", column "
                + column + ".");
          }
        }
      } else if (c == '>') {
        if (p != '\\') {
          if (start != -1) {
            group.match(start, i + 1);
            start = -1;
          } else {
            throw new ParseException("Cannot parse '" + source + "': Encountered \">\" at line " + line + ", column "
                + column + ".");
          }
        }
      } else if (c == '\n') {
        line++;
View Full Code Here

          userAccessTokens = getAccessTokens(authenticatedUserName);
        }
        catch (IOException e)
        {
          LOG.error("IO exception communicating with MCF authority service: "+e.getMessage(),e);
          throw new ParseException("IO exception communicating with MCF authority service: "+e.getMessage());
        }
      }

      BooleanQuery bq = new BooleanQuery();
      //bf.setMaxClauseCount(100000);
View Full Code Here

  // Helper method used to report on any clauses that appear in query syntax
  private void checkPhraseClauseIsForSameField(String field)
      throws ParseException {
    if (!field.equals(currentPhraseQuery.field)) {
      throw new ParseException("Cannot have clause for field \"" + field
          + "\" nested in phrase " + " for field \"" + currentPhraseQuery.field
          + "\"");
    }
  }
View Full Code Here

  @Override
  protected Query getWildcardQuery(String field, String termStr) throws ParseException {

    if (termStr == null){
      //can't imagine this would ever happen
      throw new ParseException("Passed null value as term to getWildcardQuery");
    }
    if ( ! getAllowLeadingWildcard() && (termStr.startsWith("*") || termStr.startsWith("?"))) {
      throw new ParseException("'*' or '?' not allowed as first character in WildcardQuery"
                              + " unless getAllowLeadingWildcard() returns true");
    }
   
    Matcher wildcardMatcher = wildcardPattern.matcher(termStr);
    StringBuilder sb = new StringBuilder();
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryparser.classic.ParseException

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.