Package org.apache.lucene.queryParser

Examples of org.apache.lucene.queryParser.ParseException


    when(
        searcher.flatIteratorSearch(Mockito.any(Map.class), anyString(), anyInt(), anyInt(), anyInt(),
            anyBoolean(), Mockito.any(SearchType.class), Mockito.any(List.class)))
        // emulate current indexer search behavior, illegal query results in IllegalArgEx with the ParseEx as cause
        .thenThrow(new IllegalArgumentException(new ParseException("mock")));

    try {
      resource.searchByTerms(terms, "rid", 1, 1, false, Arrays.asList(searcher));
      Assert.fail("Expected PlexusResourceException");
    }
View Full Code Here


                maybeMiles = localParams.getFloat("radius");
            }

            final Matcher matcher = PATTERN.matcher(qstr);
            if (!matcher.matches()) {
                throw new ParseException(
                        "Spatial queries should be of the format LAT,LNG");
            }

            final double lat = Double.parseDouble(matcher.group(3));
            final double lng = Double.parseDouble(matcher.group(7));
View Full Code Here

    }

    if (countTokens != tlist.size()) {
      /* this means that the analyzer used either added or consumed
       * (common for a stemmer) tokens, and we can't build a WildcardQuery */
      throw new ParseException("Cannot build WildcardQuery with analyzer "
          + getAnalyzer().getClass() + " - tokens added or lost");
    }

    if (tlist.size() == 0) {
      return null;
View Full Code Here

    if (tlist.size() == 1) {
      return super.getPrefixQuery(field, (String) tlist.get(0));
    } else {
      /* this means that the analyzer used either added or consumed
       * (common for a stemmer) tokens, and we can't build a PrefixQuery */
      throw new ParseException("Cannot build PrefixQuery with analyzer "
          + getAnalyzer().getClass()
          + (tlist.size() > 1 ? " - token(s) added" : " - token consumed"));
    }
  }
View Full Code Here

    } catch (IOException e) {
      // ignore
    }

    if (multipleTokens) {
      throw new ParseException("Cannot build FuzzyQuery with analyzer " + getAnalyzer().getClass()
          + " - tokens were added");
    }

    return (nextToken == null) ? null : super.getFuzzyQuery(field, nextToken.term(), minSimilarity);
  }
View Full Code Here

      source.close();
    } catch (IOException e) {
      // ignore
    }
    if (multipleTokens) {
      throw new ParseException("Cannot build RangeQuery with analyzer " + getAnalyzer().getClass()
          + " - tokens were added to part1");
    }

    // part2
    source = getAnalyzer().tokenStream(field, new StringReader(part2));
    try {
      nextToken = source.next(reusableToken);
      if (nextToken != null) {
        part2 = nextToken.term();
      }
      multipleTokens = source.next(reusableToken) != null;
    } catch (IOException e) {
      nextToken = null;
    }
    try {
      source.close();
    } catch (IOException e) {
      // ignore
    }
    if (multipleTokens) {
      throw new ParseException("Cannot build RangeQuery with analyzer " + getAnalyzer().getClass()
          + " - tokens were added to part2");
    }
    return super.getRangeQuery(field, part1, part2, inclusive);
  }
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

    }

    if (countTokens != tlist.size()) {
      /* this means that the analyzer used either added or consumed
       * (common for a stemmer) tokens, and we can't build a WildcardQuery */
      throw new ParseException("Cannot build WildcardQuery with analyzer "
          + getAnalyzer().getClass() + " - tokens added or lost");
    }

    if (tlist.size() == 0) {
      return null;
View Full Code Here

    if (tlist.size() == 1) {
      return super.getPrefixQuery(field, tlist.get(0));
    } else {
      /* this means that the analyzer used either added or consumed
       * (common for a stemmer) tokens, and we can't build a PrefixQuery */
      throw new ParseException("Cannot build PrefixQuery with analyzer "
          + getAnalyzer().getClass()
          + (tlist.size() > 1 ? " - token(s) added" : " - token consumed"));
    }
  }
View Full Code Here

    } catch (IOException e) {
      // ignore
    }

    if (multipleTokens) {
      throw new ParseException("Cannot build FuzzyQuery with analyzer " + getAnalyzer().getClass()
          + " - tokens were added");
    }

    return (nextToken == null) ? null : super.getFuzzyQuery(field, nextToken, minSimilarity);
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.queryParser.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.