本文整理了Java中org.apache.lucene.queryparser.classic.ParseException.initCause()
方法的一些代码示例,展示了ParseException.initCause()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParseException.initCause()
方法的具体详情如下:
包路径:org.apache.lucene.queryparser.classic.ParseException
类名称:ParseException
方法名:initCause
暂无
代码示例来源:origin: org.infinispan/infinispan-embedded-query
/** Parses a query string, returning a {@link org.apache.lucene.search.Query}.
* @param query the query string to be parsed.
* @throws ParseException if the parsing fails
*/
public Query parse(String query) throws ParseException {
ReInit(new FastCharStream(new StringReader(query)));
try {
// TopLevelQuery is a Query followed by the end-of-input (EOF)
Query res = TopLevelQuery(field);
return res!=null ? res : newBooleanQuery(false).build();
}
catch (ParseException | TokenMgrError tme) {
// rethrow to include the original query:
ParseException e = new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
e.initCause(tme);
throw e;
} catch (BooleanQuery.TooManyClauses tmc) {
ParseException e = new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
e.initCause(tmc);
throw e;
}
}
代码示例来源:origin: harbby/presto-connectors
/** Parses a query string, returning a {@link org.apache.lucene.search.Query}.
* @param query the query string to be parsed.
* @throws ParseException if the parsing fails
*/
public Query parse(String query) throws ParseException {
ReInit(new FastCharStream(new StringReader(query)));
try {
// TopLevelQuery is a Query followed by the end-of-input (EOF)
Query res = TopLevelQuery(field);
return res!=null ? res : newBooleanQuery(false).build();
}
catch (ParseException | TokenMgrError tme) {
// rethrow to include the original query:
ParseException e = new ParseException("Cannot parse '" +query+ "': " + tme.getMessage());
e.initCause(tme);
throw e;
} catch (BooleanQuery.TooManyClauses tmc) {
ParseException e = new ParseException("Cannot parse '" +query+ "': too many boolean clauses");
e.initCause(tmc);
throw e;
}
}
内容来源于网络,如有侵权,请联系作者删除!