你用的这个demo,我没用过.
我学lucene是从建立索引-->搜索,这一个过程来的.
这是我当时写的学习笔记:http://blog.csdn.net/djy1135/archive/2006/08/30/1145469.aspx,你可以参考一下.

解决方案 »

  1.   

    Unable to compile class for JSPThe method parse(String) in the type QueryParser is not applicable for the arguments (String, String, Analyzer)JSP编译不了的问题?
    方法调用不对啊。
      

  2.   

    if (error == false) {                                           //did we open the index?
                    queryString = request.getParameter("query");           //get the search criteria
                    startVal    = request.getParameter("startat");         //get the start index
                    maxresults  = request.getParameter("maxresults");      //get max results per page
                    try {
                            maxpage    = Integer.parseInt(maxresults);    //parse the max results first
                            startindex = Integer.parseInt(startVal);      //then the start index  
                    } catch (Exception e) { } //we don't care if something happens we'll just start at 0
                                              //or end at 50                                if (queryString == null)
                            throw new ServletException("no query "+       //if you don't have a query then
                                                       "specified");      //you probably played on the 
                                                                          //query string so you get the 
                                                                          //treatment                Analyzer analyzer = new StopAnalyzer();               //construct our usual analyzer
                    try {
                    out.println("queryString:" + queryString);
                     QueryParser queryParser = new QueryParser("contents", analyzer);
                     query = queryParser.parse(queryString);
                            //query = QueryParser.parse(queryString, "contents", analyzer); //parse the 
                    } catch (Exception e) {                          //query and construct the Query
                                                                          //object
                                                                          //if it's just "operator error"
                                                                          //send them a nice error HTML
                                                                          
    %>
      

  3.   

    重点在: 
    QueryParser queryParser = new QueryParser("contents", analyzer);
    query = queryParser.parse(queryString);
      

  4.   

    这是lucene2.0的API 代码
    QueryParser qp = new QueryParser("body", analyzer);      
    query = qp.parse(queryString);      
    这是lucene1.4.3版的API 
    代码
    query = QueryParser.parse(key,queryString,new new StandardAnalyzer());