如果出现了下列错误,那是因为用错了函数。把queryParser.Query改称queryParser.parse就通过了
org.apache.lucene.queryParser.ParseException: Encountered "<EOF>" at line 1, column 0.
Was expecting one of:
<NOT> ...
"+" ...
"-" ...
"(" ...
<QUOTED> ...
<TERM> ...
<PREFIXTERM> ...
<WILDTERM> ...
"[" ...
"{" ...
<NUMBER> ...
at org.apache.lucene.queryParser.QueryParser.generateParseException(QueryParser.java:1226)
at org.apache.lucene.queryParser.QueryParser.jj_consume_token(QueryParser.java:1109)
at org.apache.lucene.queryParser.QueryParser.Clause(QueryParser.java:759)
at org.apache.lucene.queryParser.QueryParser.Query(QueryParser.java:684)
at ch2.lucenedemo.process.Test.RunVsIndex(Test.java:142)
at ch2.lucenedemo.process.Test.main(Test.java:169)