Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 14740 invoked from network); 13 Feb 2007 06:04:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Feb 2007 06:04:16 -0000 Received: (qmail 68367 invoked by uid 500); 13 Feb 2007 06:04:18 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 68335 invoked by uid 500); 13 Feb 2007 06:04:18 -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 68324 invoked by uid 99); 13 Feb 2007 06:04:18 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Feb 2007 22:04:18 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [203.199.37.133] (HELO rediff.co.in) (203.199.37.133) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 12 Feb 2007 22:04:08 -0800 Received: (qmail 23223 invoked from network); 13 Feb 2007 06:00:30 -0000 Received: from unknown (HELO bhavin) (172.16.3.213) by mailserver with SMTP; 13 Feb 2007 06:00:30 -0000 Message-ID: <004801c74f37$131c8420$d50310ac@bhavin> Reply-To: "Bhavin Pandya" From: "Bhavin Pandya" To: References: <2b817f360702122134m22c93bb1q574a1388f71afe2c@mail.gmail.com> Subject: Re: hi compile error Date: Tue, 13 Feb 2007 11:50:32 +0530 Organization: rediff.com MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Checked: Checked by ClamAV on apache.org Hi ashwin, I think there is error in your import statement... import org.apache.lucene.document.Field; Thanks. Bhavin pandya ----- Original Message ----- From: "ashwin kumar" To: Sent: Tuesday, February 13, 2007 11:04 AM Subject: hi compile error > hi all my name is ashwin i am trying to compile this program but its not > getting compiled the error msg follows the code which is below > > import java.io.File; > import java.io.FileReader; > import java.io.Reader; > import java.util.Date; > > import org.apache.lucene.analysis.Analyzer; > import org.apache.lucene.analysis.standard.StandardAnalyzer; > import org.apache.lucene.document.Document; > import org.apache.lucene.document.Field.*; > import org.apache.lucene.index.IndexWriter; > > /** > * This class demonstrates the process of creating an index with Lucene > * for text files in a directory. > */ > public class TextFileIndexer > { > public static void main(String[] args) throws Exception > { > > File fileDir = new File("C:\\files_to_index ");//fileDir is the > directory that contains the text files to be indexed > > File indexDir = new File("C:\\luceneIndex"); //indexDir is the > directory that hosts Lucene's index files > > Analyzer luceneAnalyzer = new StandardAnalyzer(); > > IndexWriter indexWriter = new > IndexWriter(indexDir,luceneAnalyzer,true); > > File[] textFiles = fileDir.listFiles(); > > long startTime = new Date().getTime(); > > for(int i = 0; i < textFiles.length; i++) > { > if(textFiles[i].isFile() && > textFiles[i].getName().endsWith(".txt")) > { > System.out.println("File " + > textFiles[i].getCanonicalPath()+ " is being indexed"); > Reader textReader = new FileReader(textFiles[i]); > Document document = new Document(); > document.add(Field.Text("content",textReader)); > > document.add(Field.Text("path",textFiles[i].getPath())); > indexWriter.addDocument(document); > } > } > > indexWriter.optimize(); > indexWriter.close(); > long endTime = new Date().getTime(); > > System.out.println("It took " + (endTime - startTime) > + " milliseconds to create an index for the files in the > directory " > + fileDir.getPath()); > } > } > > error msg: > > --------------------Configuration: -------------------- > D:\ASHWIN\testing\searching\TextFileIndexer.java:40: cannot find symbol > symbol : variable Field > location: class TextFileIndexer > document.add(Field.Text("content",textReader)); > ^ > D:\ASHWIN\testing\searching\TextFileIndexer.java:41: cannot find symbol > symbol : variable Field > location: class TextFileIndexer > document.add(Field.Text("path",textFiles[i].getPath())); > ^ > 2 errors > > Process completed. > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org