Hi, I'm trying to use latest ver of Lucene (Release 2.0.0), but unable
to run its example.
When I tried to run it it throws an exception (see bellow). Hence I
need information about how to resolve this problem or should I use the
lower ver of it?
Error compiling file:
D:\projects\server\web\tomcat\work\_\localhost\rChive\Lucene\/results_jsp.java
[javac] Compiling 1 source file
D:\projects\server\web\tomcat\work\_\localhost\rChive\Lucene\results_jsp.java:167:
parse(java.lang.String) in org.apache.lucene.queryParser.QueryParser
cannot be applied to
(java.lang.String,java.lang.String,org.apache.lucene.analysis.Analyzer)
query = QueryParser.parse(queryString,
"contents", analyzer);
^
Note:
D:\projects\server\web\tomcat\work\_\localhost\rChive\Lucene\results_jsp.java
uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note:
D:\projects\server\web\tomcat\work\_\localhost\rChive\Lucene\results_jsp.java
uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
Desperately need your suggestion.
ThankQ
Sam
bgunaratnam@hotmail.com - 05 Jul 2006 19:40 GMT
Sam - I have run into the exact same problem.
It looks like Lucene version 2.0 is using a single arguement for
QueryParser.parse(String query) instead of QueryParser.parse(String
query, String field, Analyzer analyzer).
If anyone knows how to implement the latter with the new version of
lucene, please provide an example.
Thanks.
> Hi, I'm trying to use latest ver of Lucene (Release 2.0.0), but unable
> to run its example.
[quoted text clipped - 27 lines]
> ThankQ
> Sam
bgunaratnam@hotmail.com - 05 Jul 2006 19:54 GMT
This should do the trick:
lucene 1.4
Query query = QueryParser.parse("someSearchQuery","someField",
analyzer);
replace with...
lucene 2.0
QueryParser qp = new QueryParser("someField", analyzer);
Query query = qp.parse("someSearchQuery");
> Sam - I have run into the exact same problem.
>
[quoted text clipped - 38 lines]
> > ThankQ
> > Sam