From lucene-dev-return-6338-apmail-jakarta-lucene-dev-archive=jakarta.apache.org@jakarta.apache.org Sat May 08 22:11:28 2004 Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 62062 invoked from network); 8 May 2004 22:11:28 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 8 May 2004 22:11:28 -0000 Received: (qmail 92412 invoked by uid 500); 8 May 2004 22:11:11 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 92402 invoked by uid 500); 8 May 2004 22:11:11 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 92376 invoked from network); 8 May 2004 22:11:10 -0000 Received: from unknown (HELO services.india.aalayance.com) (203.200.48.226) by daedalus.apache.org with SMTP; 8 May 2004 22:11:10 -0000 Received: from ajitendra (unknown [192.168.1.141]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by services.india.aalayance.com (Postfix) with ESMTP id 02CE2C1888 for ; Sun, 9 May 2004 03:41:15 +0530 (IST) Message-ID: <001001c43548$ec594f90$8d01a8c0@india.aalayance.com> From: "jitender ahuja" To: "Lucene Developers List" References: <005d01c43426$5d133d00$8d01a8c0@india.aalayance.com> Subject: Re: Hit Id < 10 in new stop words' table Standard Analyzer causes error Date: Sun, 9 May 2004 03:37:57 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Sir, I have corrected the error , however it depends on repassing the clicked hits' OBJECT_ID value to queryparser object. The code is presented below for the jsp page responsible for hits' iteration. What I did was taking the retrieved hits and passing the clicked one to the same page using the request.getparameter() in the jsp page. Now, by error the retrieved OBJECT_ID was again passed to the queryparser. This caused the error, that too if the modified StandardAnalyzer class extended upon the Analyzer class and not the StandardAnalyzer class.( It lead me to believe that some class depends upon the original StandardAnalyzer class alone) Also, regarding your stmt. regarding the passing of a new STOP_WORD list to the constructor of the StandardAnalyzer class, it is not reflected in the output web page. It is passed however, if the new class extends upon the Analyzer class, i.e. the modified StandardAnalyzer class has the statement : "public class StandardAnalyzer extends org.apache.lucene.analysis.Analyzer { " Regards, Jitender The jsp code for taking the query from a previous page and retrieving hits and the clicked hits' data:: ---------------------------------------------------------------------------- ---------------------------- // There are 2 index fields: OBJECT_ID is a keyword field, while the OBJECT_XML is a Text field(Reader) try {searcher = new IndexSearcher(IndexReader.open(indexName)); } catch (Exception e) { e.printStackTrace(); error = true; } if (error == false) { queryString = request.getParameter("query"); //passed from the previous page recieving the query if (queryString == null) throw new ServletException("no query "+ "specified"); org.apache.lucene.analysis.Analyzer analyzer = new org.apache.lucene.modanalysis.StandardAnalyzer(); try { query = QueryParser.parse(queryString, "OBJECT_XML", analyzer); } catch (ParseException e) { error = true; } } if (error == false && searcher != null) { thispage = maxpage; hits = searcher.search(query); if (hits.length() == 0) { error = true; } } if (error == false && searcher != null) { for ( int i = startindex; i < (thispage + startindex); i++) { Document doc = hits.doc(i); String url = doc.get("OBJECT_ID"); String srchString1 = request.getParameter("url"); if(srchString1 != null) String srchString = srchString1; else if(srchString1 == null) // i.e. if no hits' retrieved links is clicked upon then display data // of the first link of the retrieved results srchString = hits.doc(0).get("OBJECT_ID"); ////earlier code presented below : and also the reason for error, the removed lines are indicated by a "-" in the new code and the new///// //// added lines are indicated by a "+" ////// - try { - searcher = new IndexSearcher(IndexReader.open(indexName)); - }catch (Exception e) { - e.printStackTrace(); - error = true; - } - if (error == false) { - org.apache.lucene.analysis.Analyzer analyzer = new org.apache.lucene.modanalysis.StandardAnalyzer(); - try{ - query = QueryParser.parse(srchString, "OBJECT_ID", analyzer); - }catch(ParseException e){ - error = true; - } - } - if (error == false && searcher != null){ - hits = searcher.search(query); - Document doc = hits.doc(0); - String datas = doc.get("OBJECT_ID") DataRoche abc = new DataRoche();//this class retrieves the actual data for a particular OBJECT_ID //by accessing the Oracle database over a thin client - String data = abc.getdata( datas ); + String data = abc.getdata( srchString ); // next the "data" is displayed } ----- Original Message ----- From: "Erik Hatcher" To: "Lucene Developers List" Sent: Friday, May 07, 2004 6:03 PM Subject: Re: Hit Id < 10 in new stop words' table Standard Analyzer causes error > Could you provide your code on how you are iterating the hits? > > Also, you don't need to modify the StandardAnalyzer for a new stop > words list - it allows you to pass a list in its constructor. > > Erik > > > On May 7, 2004, at 7:28 AM, jitender ahuja wrote: > > > Hi , > > I am modifying the Standard Analyzer to include a new Stop-Words > > list, and am working on an Index with 2 fields: 1) OBJECT_ID serving > > to identify a document: a keyword field , and 2) OBJECT_XML: a text > > field with Reader i.e., tokenised and indexed but not stored. > > Now, in response to the query string the results are retrieved > > correctly.Then, one need to click on the retrieved hits to get the > > data from the database through a seperate java class in the underlying > > jsp file , for a particular OBJECT_ID. > > > > But it gives the following error for Hit Ids (OBJECT_ID) < 10 on > > clicking it to retrieve the data field from the database. > > > > org.apache.jasper.JasperException: Not a valid hit number: 0 > > > > Also, pl. do note that:: If the old analyzer is just used from the > > different folder it causes no error. > > > > Can , anyone tell why this weird behavior is exhibited? > > > > > > Regards, > > Jitender > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-dev-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-dev-help@jakarta.apache.org