Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 54238 invoked from network); 30 Oct 2003 11:35:30 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 30 Oct 2003 11:35:30 -0000 Received: (qmail 86781 invoked by uid 500); 30 Oct 2003 11:35:26 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 86617 invoked by uid 500); 30 Oct 2003 11:35:25 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 86592 invoked from network); 30 Oct 2003 11:35:24 -0000 Received: from unknown (HELO web12702.mail.yahoo.com) (216.136.173.239) by daedalus.apache.org with SMTP; 30 Oct 2003 11:35:24 -0000 Message-ID: <20031030113524.13337.qmail@web12702.mail.yahoo.com> Received: from [194.152.209.219] by web12702.mail.yahoo.com via HTTP; Thu, 30 Oct 2003 03:35:24 PST Date: Thu, 30 Oct 2003 03:35:24 -0800 (PST) From: Otis Gospodnetic Subject: Re: Indexing txt-files To: Lucene Users List In-Reply-To: <003a01c39eb9$21f4de20$1a0011ac@TFEW02> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 This is from Lucene demo, included in Lucene distribution. Look at FileDocument class: // Add the contents of the file a field named "contents". Use a Text // field, specifying a Reader, so that the text of the file is tokenized. // ?? why doesn't FileReader work here ?? FileInputStream is = new FileInputStream(f); Reader reader = new BufferedReader(new InputStreamReader(is)); doc.add(Field.Text("contents", reader)); Otis --- G�nter_Kukies wrote: > Hello, > > I want to add a Text field to a LUCENE Document. I checked the index > with LUKE, but I don't get any results for search in the contents > Field. The test.txt is a simple ASCII-File. SimpleAnalyzer is used on > both sides search and index. > > Here are the relevant code snippets: > > > File file = new File("/documents/test.txt"); > > addContent(document, new FileInputStream( file )); > > > private static void addContent(Document document, InputStream is) > throws IOException { > try { > InputStreamReader input = new InputStreamReader(is); > document.add(Field.Text("contents", input )); > } > catch(Exception ex) { > ex.printStackTrace(); > } > finally { > if( is != null ) { > is.close(); > } > } > } > > > Thanks for your help > > G�nter __________________________________ Do you Yahoo!? Exclusive Video Premiere - Britney Spears http://launch.yahoo.com/promos/britneyspears/ --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org