@Test public void test6() throws ParseException { SuperParser parser = new SuperParser(LUCENE_VERSION, _fieldManager, true, null, ScoreType.SUPER, new Term( "_primedoc_")); try { parser.parse("super : <a:a d:{e TO d} b:b super:<test:hello\\<>> super:<c:c d:d>"); fail(); } catch (ParseException e) { } }
public Query parse(final String queryStr) throws ParseException { final Map<String, Query> subQueries = new HashMap<String, Query>(); final StringBuilder builder = new StringBuilder(); match(queryStr, new Group() { int _subQueryIndex = 0; @Override public void match(int start, int end) throws ParseException { if (_lastStart != start) { builder.append(queryStr.substring(_lastEnd, start)); } String realQuery = queryStr.substring(start, end); LOG.debug("Realquery [{0}]", realQuery); String superQueryStr = getMatchText(realQuery); 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); } subQueries.put(key, query); builder.append(_prefixToSub).append(':').append(_subQueryIndex); _subQueryIndex++; _lastStart = start; _lastEnd = end; } private String getMatchText(String match) { return match.substring(1, match.length() - 1); } }); if (_lastEnd < queryStr.length()) { builder.append(queryStr.substring(_lastEnd)); } Query query = super.parse(builder.toString()); return fixNegatives(reprocess(replaceRealQueries(query, subQueries))); }
SuperParser extends BlurQueryParser { public Query parse(final String queryStr) throws ParseException { final Map<String, Query> subQueries = new HashMap<String, Query>(); final StringBuilder builder = new StringBuilder(); match(queryStr, new Group() { int _subQueryIndex = 0; @Override public void match(int start, int end) throws ParseException { if (_lastStart != start) { builder.append(queryStr.substring(_lastEnd, start)); } String realQuery = queryStr.substring(start, end); LOG.debug("Realquery [{0}]", realQuery); String superQueryStr = getMatchText(realQuery); 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); } subQueries.put(key, query); builder.append(_prefixToSub).append(':').append(_subQueryIndex); _subQueryIndex++; _lastStart = start; _lastEnd = end; } private String getMatchText(String match) { return match.substring(1, match.length() - 1); } }); if (_lastEnd < queryStr.length()) { builder.append(queryStr.substring(_lastEnd)); } Query query = super.parse(builder.toString()); return fixNegatives(reprocess(replaceRealQueries(query, subQueries))); } }
SuperParser extends BlurQueryParser { public Query parse(final String queryStr) throws ParseException { final Map<String, Query> subQueries = new HashMap<String, Query>(); final StringBuilder builder = new StringBuilder(); match(queryStr, new Group() { int _subQueryIndex = 0; @Override public void match(int start, int end) throws ParseException { if (_lastStart != start) { builder.append(queryStr.substring(_lastEnd, start)); } String realQuery = queryStr.substring(start, end); LOG.debug("Realquery [{0}]", realQuery); String superQueryStr = getMatchText(realQuery); 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); } subQueries.put(key, query); builder.append(_prefixToSub).append(':').append(_subQueryIndex); _subQueryIndex++; _lastStart = start; _lastEnd = end; } private String getMatchText(String match) { return match.substring(1, match.length() - 1); } }); if (_lastEnd < queryStr.length()) { builder.append(queryStr.substring(_lastEnd)); } Query query = super.parse(builder.toString()); return fixNegatives(reprocess(replaceRealQueries(query, subQueries))); } SuperParser(Version matchVersion, FieldManager fieldManager, boolean superSearch, Filter queryFilter,
      ScoreType scoreType, Term defaultPrimeDocTerm); }
SuperParser extends BlurQueryParser { public Query parse(final String queryStr) throws ParseException { final Map<String, Query> subQueries = new HashMap<String, Query>(); final StringBuilder builder = new StringBuilder(); match(queryStr, new Group() { int _subQueryIndex = 0; @Override public void match(int start, int end) throws ParseException { if (_lastStart != start) { builder.append(queryStr.substring(_lastEnd, start)); } String realQuery = queryStr.substring(start, end); LOG.debug("Realquery [{0}]", realQuery); String superQueryStr = getMatchText(realQuery); 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); } subQueries.put(key, query); builder.append(_prefixToSub).append(':').append(_subQueryIndex); _subQueryIndex++; _lastStart = start; _lastEnd = end; } private String getMatchText(String match) { return match.substring(1, match.length() - 1); } }); if (_lastEnd < queryStr.length()) { builder.append(queryStr.substring(_lastEnd)); } Query query = super.parse(builder.toString()); return fixNegatives(reprocess(replaceRealQueries(query, subQueries))); } SuperParser(Version matchVersion, FieldManager fieldManager, boolean superSearch, Filter queryFilter,
      ScoreType scoreType, Term defaultPrimeDocTerm); Query parse(final String queryStr); }
SuperParser extends BlurQueryParser { public Query parse(final String queryStr) throws ParseException { final Map<String, Query> subQueries = new HashMap<String, Query>(); final StringBuilder builder = new StringBuilder(); match(queryStr, new Group() { int _subQueryIndex = 0; @Override public void match(int start, int end) throws ParseException { if (_lastStart != start) { builder.append(queryStr.substring(_lastEnd, start)); } String realQuery = queryStr.substring(start, end); LOG.debug("Realquery [{0}]", realQuery); String superQueryStr = getMatchText(realQuery); 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); } subQueries.put(key, query); builder.append(_prefixToSub).append(':').append(_subQueryIndex); _subQueryIndex++; _lastStart = start; _lastEnd = end; } private String getMatchText(String match) { return match.substring(1, match.length() - 1); } }); if (_lastEnd < queryStr.length()) { builder.append(queryStr.substring(_lastEnd)); } Query query = super.parse(builder.toString()); return fixNegatives(reprocess(replaceRealQueries(query, subQueries))); } SuperParser(Version matchVersion, FieldManager fieldManager, boolean superSearch, Filter queryFilter,
      ScoreType scoreType, Term defaultPrimeDocTerm); Query parse(final String queryStr);  }