Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 57148 invoked from network); 8 Aug 2008 13:16:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Aug 2008 13:16:50 -0000 Received: (qmail 72056 invoked by uid 500); 8 Aug 2008 13:16:42 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 72026 invoked by uid 500); 8 Aug 2008 13:16:42 -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 72015 invoked by uid 99); 8 Aug 2008 13:16:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 06:16:42 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [72.44.153.253] (HELO Jb_va_exchange.jbmanage.corp) (72.44.153.253) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Aug 2008 13:15:44 +0000 Received: from mail pickup service by Jb_va_exchange.jbmanage.corp with Microsoft SMTPSVC; Fri, 8 Aug 2008 09:15:48 -0400 Received: from YOUR4E78C11890 ([74.94.63.101]) by Jb_va_exchange.jbmanage.corp with Microsoft SMTPSVC(6.0.3790.3959); Fri, 8 Aug 2008 09:15:48 -0400 From: "Brittany Jacobs" To: Subject: RE: LineDocMaker usage Date: Fri, 8 Aug 2008 09:11:41 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <867513fe0808061930ra0edeafg5e288b7c2ecf2542@mail.gmail.com> Thread-Index: Acj4NaxvOz7jpAKwTg+zkZw+RNiyrABIpskg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 Message-ID: X-CTCH-ID: _0B9FF9E7-067E-4F1F-9CAE-0A6152923EE6_ X-CTCH-RefID: str=0001.0A010205.489C4704.005E,ss=1,fgs=0 X-CTCH-Action: Ignore X-OriginalArrivalTime: 08 Aug 2008 13:15:48.0177 (UTC) FILETIME=[DF795C10:01C8F958] X-Virus-Checked: Checked by ClamAV on apache.org Thank you so much! Brittany Jacobs Java Developer JBManagement, Inc. 12 Christopher Way, Suite 103 Eatontown, NJ 07724 ph: 732-542-9200 ext. 229 fax: 732-380-0678 email: bjacobs@jbmanagement.com -----Original Message----- From: Anshum [mailto:anshumg@gmail.com] Sent: Wednesday, August 06, 2008 10:30 PM To: java-user@lucene.apache.org Subject: Re: LineDocMaker usage Hi, How about just opening a file and parsing through it while adding doing a doc.add on each newline? That should be pretty straight and simple. Just writing the snippet here, though this might have issues as didnt try to compile it. IndexWriter writer = new IndexWriter(indexDir, new StandardAnalyzer(), true); FileInputStream fstream = new FileInputStream("textfile.txt"); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { Document doc = new Document(); doc.add(new Field("filename", f.getCanonicalPath(),Field.Store.YES,Field.Index.TOKENIZED)); doc.add(new Field("filename", strLine,Field.Store.YES,Field.Index.TOKENIZED));//DEPENDING UPON HOW YOU WANT TO INDEX IT writer.addDocument(doc); } in.close(); writer.close(); Also, I have tokenized the content and stored it so that it could be fetched, you might just want to have a ref key instead of storing the entrire content though. Upto you for implementation. -- Anshum http://ai-cafe.blogspot.com On Thu, Aug 7, 2008 at 1:42 AM, Brittany Jacobs wrote: > Hello, I am new to all this. I need to read in a text file and have each > line in the file be a document. > > The LineDocMaker seems to be intended for this purpose. But I can't figure > out how to read the data into it. > > Any examples would be greatly appreciated. > > > > -- -- The facts expressed here belong to everybody, the opinions to me. The distinction is yours to draw............ --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org