Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 79184 invoked from network); 30 Mar 2009 07:37:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 30 Mar 2009 07:37:38 -0000 Received: (qmail 24022 invoked by uid 500); 30 Mar 2009 07:37:35 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 23940 invoked by uid 500); 30 Mar 2009 07:37:35 -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 23930 invoked by uid 99); 30 Mar 2009 07:37:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Mar 2009 07:37:35 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [194.150.248.188] (HELO srv5.tophost.ch) (194.150.248.188) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 30 Mar 2009 07:37:24 +0000 Received: from 84-75-190-174.dclient.hispeed.ch ([84.75.190.174] helo=lovebone.local) by srv5.tophost.ch with esmtp (Exim 4.69) (envelope-from ) id 1LoC3L-00022n-U2 for java-user@lucene.apache.org; Mon, 30 Mar 2009 09:37:03 +0200 From: Timon Roth Organization: digitalforce.ch To: java-user@lucene.apache.org Subject: newbie question again Date: Mon, 30 Mar 2009 09:43:41 +0200 User-Agent: KMail/1.9.9 X-Face: 3g[Lw=dsrA^H%%tl)ug^KaSvBtt#kmR;v$iW/()=g^,w%R;BhyoOI[#_)e>pE%!Na:Kc96MfJn?==J4YTZU/yk1`@/l&p!&`$ MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_tgH0JXFT67ZoS1C" Message-Id: <200903300943.41060.timon.roth@digitalforce.ch> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - srv5.tophost.ch X-AntiAbuse: Original Domain - lucene.apache.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - digitalforce.ch X-Virus-Checked: Checked by ClamAV on apache.org --Boundary-00=_tgH0JXFT67ZoS1C Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline hello list sory, this is maeby a stupid questin, but i can't resolve. so maeby you can help me: i try to compile the indexer-example from the book lucene in action, 2nd edition (http://www.manning.com/hatcher3/hatcher_meapch1.pdf), but get the following error: ---------------------------------------------------------------------- javac -Xlint -cp ":.:./lucene/lucene-core-2.4.1.jar" Indexer.java Indexer.java:37: cannot find symbol symbol : constructor FSDirectory(java.io.File,) location: class org.apache.lucene.store.FSDirectory Directory dir = new FSDirectory(new File(indexDir), null); ^ 1 error ---------------------------------------------------------------------- it means the following codesgement: public Indexer(String indexDir) throws IOException { Directory dir = new FSDirectory(new File(indexDir)); writer = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.maxFieldLength.UNLIMITED); } im using debian testing with.. java -version java version "1.6.0_0" OpenJDK Runtime Environment (build 1.6.0_0-b11) OpenJDK Server VM (build 1.6.0_0-b11, mixed mode) sourcecode+makefile are attached: thanks for your help, timon --Boundary-00=_tgH0JXFT67ZoS1C Content-Type: text/x-java; charset="iso 8859-15"; name="Indexer.java" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Indexer.java" import org.apache.lucene.index.IndexWriter; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Directory; import java.io.File; import java.io.IOException; import java.io.FileReader; public class Indexer { private IndexWriter writer; public static void main(String[] args) throws Exception { if (args.length != 2) { throw new Exception("Usage: java " + Indexer.class.getName() + " "); } String indexDir = args[0]; String dataDir = args[1]; long start = System.currentTimeMillis(); Indexer indexer = new Indexer(indexDir); int numIndexed = indexer.index(dataDir); indexer.close(); long end = System.currentTimeMillis(); System.out.println("Indexing " + numIndexed + " files took " + (end - start) + " milliseconds"); } public Indexer(String indexDir) throws IOException { Directory dir = new FSDirectory(new File(indexDir), null); writer = new IndexWriter(dir, new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED); } public void close() throws IOException { writer.close(); } public int index(String dataDir) throws Exception { File[] files = new File(dataDir).listFiles(); for (int i = 0; i < files.length; i++) { File f = files[i]; if (!f.isDirectory() && !f.isHidden() && f.exists() && f.canRead() && acceptFile(f)) { indexFile(f); } } return writer.numDocs(); } protected boolean acceptFile(File f) { return f.getName().endsWith(".txt"); } protected Document getDocument(File f) throws Exception { Document doc = new Document(); doc.add(new Field("contents", new FileReader(f))); doc.add(new Field("filename", f.getCanonicalPath(), Field.Store.YES, Field.Index.NOT_ANALYZED)); return doc; } private void indexFile(File f) throws Exception { System.out.println("Indexing " + f.getCanonicalPath()); Document doc = getDocument(f); if (doc != null) { writer.addDocument(doc); } } } --Boundary-00=_tgH0JXFT67ZoS1C Content-Type: text/x-makefile; charset="iso 8859-15"; name="Makefile" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Makefile" LANG='de_CH'; CP="$(CLASSPATH):.:./lucene/lucene-core-2.4.1.jar" all: javac -Xlint -cp $(CP) Indexer.java --Boundary-00=_tgH0JXFT67ZoS1C Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --Boundary-00=_tgH0JXFT67ZoS1C--