Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 64889 invoked from network); 15 Feb 2008 17:09:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Feb 2008 17:09:54 -0000 Received: (qmail 4537 invoked by uid 500); 15 Feb 2008 17:09:36 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 4507 invoked by uid 500); 15 Feb 2008 17:09:36 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 4496 invoked by uid 99); 15 Feb 2008 17:09:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 09:09:36 -0800 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [61.95.162.82] (HELO kecgate06.infosys.com) (61.95.162.82) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Feb 2008 17:09:05 +0000 Received: from indhubbhs01.ad.infosys.com ([192.168.200.81]) by kecgate06.infosys.com with InterScan Message Security Suite; Fri, 15 Feb 2008 22:39:48 +0530 Received: from blrkechub02.ad.infosys.com ([10.66.236.42]) by indhubbhs01.ad.infosys.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 15 Feb 2008 22:39:12 +0530 Received: from BLRKECMBX06.ad.infosys.com ([10.66.236.32]) by blrkechub02.ad.infosys.com ([10.66.236.42]) with mapi; Fri, 15 Feb 2008 22:39:12 +0530 From: Allahbaksh Mohammedali Asadullah To: "java-user@lucene.apache.org" Date: Fri, 15 Feb 2008 22:39:08 +0530 Subject: RE: Boost value corrupted "read eof exception" Thread-Topic: Boost value corrupted "read eof exception" Thread-Index: Achv9L8bxuMnfDTRSKSrK1wowBdlrAAAHPaw Message-ID: <68959F25CDEBCB4F917D5A253291D73E07CDAC3CB1@BLRKECMBX06.ad.infosys.com> References: <68959F25CDEBCB4F917D5A253291D73E07CDAC3CAD@BLRKECMBX06.ad.infosys.com> <6B028357-D045-4387-B1E5-78063A882054@mikemccandless.com> In-Reply-To: <6B028357-D045-4387-B1E5-78063A882054@mikemccandless.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginalArrivalTime: 15 Feb 2008 17:09:12.0122 (UTC) FILETIME=[7C2F89A0:01C86FF5] X-Virus-Checked: Checked by ClamAV on apache.org Hi, Thanks for your valuable time.Could you get the same boost value what you h= ad stored. In my case I always get boost value as 1 ie. Default value. When= I debug it goes through IOException though it does not show any Exception = on the console in eclipse. Regards, Allahbaksh -----Original Message----- From: Michael McCandless [mailto:lucene@mikemccandless.com] Sent: Friday, February 15, 2008 10:34 PM To: java-user@lucene.apache.org Subject: Re: Boost value corrupted "read eof exception" I had to comment out the "search" lines. But then when I run this I don't hit any exception. Tested on Linux & Windows XP. Mike Allahbaksh Mohammedali Asadullah wrote: > > Hi, > I am using lucene 2.3. The exception is properly handled when I run > the program by lucene but when I debug it it hit the exception at > addDocuement. > Regards, > Allahbaksh > > > > import java.io.IOException; > > import java.io.StringReader; > > > > import org.apache.lucene.search.Hits; > > import org.apache.lucene.search.Query; > > import org.apache.lucene.document.Field; > > import org.apache.lucene.search.Searcher; > > import org.apache.lucene.index.IndexWriter; > > import org.apache.lucene.document.Document; > > import org.apache.lucene.store.FSDirectory; > > import org.apache.lucene.store.RAMDirectory; > > import org.apache.lucene.search.IndexSearcher; > > import org.apache.lucene.queryParser.QueryParser; > > import org.apache.lucene.queryParser.ParseException; > > import org.apache.lucene.analysis.StopAnalyzer; > > import org.apache.lucene.analysis.standard.StandardAnalyzer; > > > > public class InMemoryExample { > > > > public static void main(String[] args) throws IOException { > > // Construct a RAMDirectory to hold the in-memory > representation > > // of the index. > > RAMDirectory idx =3D new RAMDirectory(); > > FSDirectory fs =3DFSDirectory.getDirectory("Z:\\lucene_index"); > > //idx.createOutput("d:/idx"); > > try { > > // Make an writer to create the index > > IndexWriter writer =3D > > new IndexWriter(fs, true,new StandardAnalyzer()); > > > > // Add some Document objects containing quotes > > writer.addDocument(createDocument("Theodore Roosevelt", > > // "It behooves every man to remember that the work > of the " + > > // "critic, is of altogether secondary importance, > and that, " + > > //"in the end, progress is accomplished by the man > who does " + > > "things.")); > > writer.addDocument(createDocument("Friedrich Hayek", > > // "The case for individual freedom rests largely on > the " + > > > > > > //"recognition of the inevitable and > universal ignorance " + > > //"of all of us concerning a great many of the > factors on " + > > "which the achievements of our ends and welfare > depend."),new StandardAnalyzer()); > > writer.addDocument(createDocument("Ayn Rand", > > //"There is nothing to take a man's freedom away > from " + > > //"him, save other men. To be free, a man must be > free " + > > "of his brothers.")); > > writer.addDocument(createDocument("Mohandas Gandhi", > > //"Freedom is not worth having if it does not > connote " + > > "freedom to err.")); > > > > // Optimize and close the writer to finish building the > index > > // writer.optimize(); > > writer.close(); > > > > // Build an IndexSearcher using the in-memory index > > Searcher searcher =3D new IndexSearcher(fs); > > > > // Run some queries > > search(searcher, "freedom"); > > search(searcher, "free"); > > search(searcher, "progress or achievements"); > > > > searcher.close(); > > } > > catch(IOException ioe) { > > // In this example we aren't really doing an I/O, so this > > // exception should never actually be thrown. > > ioe.printStackTrace(); > > } > > catch(ParseException pe) { > > pe.printStackTrace(); > > } > > } private static Document createDocument(String title, > String content) { > > Document doc =3D new Document(); > > > > // Add the title as an unindexed field... > > Field f1 =3D new Field("title",title, > Field.Store.YES,Field.Index.TOKENIZED); > > float temp =3D (float)Math.random(); > > > > System.out.print("Title of document is "+title +" Field 1 > Boost value "+temp); > > f1.setBoost(temp); > > doc.add(f1); > > > > // ...and the content as an indexed field. Note that indexed > > // Text fields are constructed using a Reader. Lucene can read > > // and index very large chunks of text, without storing the > > // entire content verbatim in the index. In this example we > > // can just wrap the content string in a StringReader. > > > > temp =3D(float)Math.random(); > > Field f2 =3Dnew Field > ("content",content,Field.Store.YES,Field.Index.TOKENIZED); > > f2.setBoost(temp); > > doc.add(f2); > > System.out.println(" Field 2 Boost value is " +temp); > > return doc; > > } > > } > > > Allahbaksh Mohammedali Asadullah, > Software Engineering & Technology Labs, > Infosys Technolgies Limited, Electronics City, > Hosur Road, Bangalore 560 100, India. > *Board: +91-80-28520261 | Extn: 53915 | Direct: 41173915. > Fax: +91-80-28520362 | Mobile: +91-9845505322. > http://setlabs/slim/ > http://allahbaksh.blogspot.com > > -----Original Message----- > From: Michael McCandless [mailto:lucene@mikemccandless.com] > Sent: Friday, February 15, 2008 9:57 PM > To: java-user@lucene.apache.org > Subject: Re: Boost value corrupted "read eof exception" > > > Which version of Lucene are you using? > > Can you post the full stack trace for the exception you're hitting? > > Mike > > Allahbaksh Mohammedali Asadullah wrote: > >> >> Hi, >> I am getting read past eof exception when I am adding Document. >> The things works fine but while I read the Boost value I get it as >> default value i.e 1.0. I tried using RAMDirectory then also I am >> getting the same error. >> Can someone throw some light on this. >> >> Warm Regards, >> Allahbaksh >> >> >> >> >> >> **************** CAUTION - Disclaimer ***************** >> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION >> intended solely for the use of the addressee(s). If you are not the >> intended recipient, please notify the sender by e-mail and delete >> the original message. Further, you are not to copy, disclose, or >> distribute this e-mail or its contents to any other person and any >> such actions are unlawful. This e-mail may contain viruses. Infosys >> has taken every reasonable precaution to minimize this risk, but is >> not liable for any damage you may sustain as a result of any virus >> in this e-mail. You should carry out your own virus checks before >> opening the e-mail or attachment. Infosys reserves the right to >> monitor and review the content of all messages sent to or from this >> e-mail address. Messages sent to or from this e-mail address may be >> stored on the Infosys e-mail system. >> ***INFOSYS******** End of Disclaimer ********INFOSYS*** > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org