""
Exception in thread "main" java.lang.NullPointerException at org.apache.lucene.analysis.StopFilter.getEnablePositionIncrementsVersionDefault(StopFilter.java:162) at org.apache.lucene.analysis.standard.StandardAnalyzer.<init>(StandardAnalyzer.java:73) at org.apache.lucene.analysis.standard.StandardAnalyzer.<init>(StandardAnalyzer.java:63) at Con.main(Con.java:29) """ did you get also this message after the compilation? br Marc Schwarz wrote: > > I had that problem yesterday... this works in my app: > > Directory directory = new SimpleFSDirectory(new > File("c:\\lucene\\index")); > > IndexWriter w = new IndexWriter(directory, analyzer,true, > new IndexWriter.MaxFieldLength(25000)); > > > > -----Ursprüngliche Nachricht----- > Von: Erick Erickson [mailto:erickerick...@gmail.com] > Gesendet: Donnerstag, 28. Januar 2010 21:47 > An: java-user@lucene.apache.org > Betreff: Re: index a database > > What version are you using? Because there's no such constructor > (i.e. one that takes a File) in 3.0..... > > You might want to use something like FSDirectory.open(file) in > your IndexWriter constructor.... > > If this doesn't work, more details please.... > > Erick > > On Thu, Jan 28, 2010 at 3:30 PM, luciusvorenus > <lucius.vore...@hotmail.de>wrote: > >> >> Hello >> >> I tried to index a database >> >> "" >> import org.apache.lucene.demo.FileDocument; >> import org.apache.lucene.document.Document; >> import org.apache.lucene.document.Field; >> import org.apache.lucene.analysis.Analyzer; >> import org.apache.lucene.analysis.standard.StandardAnalyzer; >> import org.apache.lucene.index.IndexWriter; >> import org.apache.lucene.search.IndexSearcher; >> import org.apache.lucene.search.Query; >> import org.apache.lucene.queryParser.QueryParser; >> import org.apache.lucene.store.FSDirectory; >> import org.apache.lucene.util.Version; >> import java.sql.*; >> import java.util.Properties; >> import org.apache.lucene.document.*; >> import java.io.*; >> import org.apache.lucene.store.Directory; >> import org.apache.lucene.store.FSDirectory; >> >> public class Con{ >> public static void main(String[] args) throws Exception >> >> { >> final File INDEX_DIR = new File("index"); >> >> >> Class.forName("com.mysql.jdbc.Driver").newInstance(); >> Connection conn = >> DriverManager.getConnection("jdbc:mysql://127.0.0.1/test", "root", >> "passwort"); >> StandardAnalyzer analyzer = new StandardAnalyzer(null); >> IndexWriter writer = new IndexWriter(INDEX_DIR, > analyzer, >> true); >> System.out.println("Indexing to directory '" + >> INDEX_DIR >> + "'..."); >> indexDocs(writer, conn); >> writer.optimize(); >> writer.close(); >> >> >> >> } >> >> >> private static void indexDocs(IndexWriter writer, Connection conn) >> throws >> Exception { >> String sql = "select c_id, city from city"; >> Statement stmt = conn.createStatement(); >> ResultSet rs = stmt.executeQuery(sql); >> while (rs.next()) { >> Document d = new Document(); >> d.add(new Field("c_id", rs.getString("c_id"), >> Field.Store.YES, >> Field.Index.NO)); >> d.add(new Field("city", rs.getString("city"), Field.Store.NO, >> Field.Index.ANALYZED)); >> >> writer.addDocument(d); >> } >> >> } >> } >> """ >> and i get this message >> >> "" >> symbol : constructor >> >> > IndexWriter(java.io.File,org.apache.lucene.analysis.standard.StandardAnalyze > r,boolean) >> location: class org.apache.lucene.index.IndexWriter >> IndexWriter writer = new IndexWriter(INDEX_DIR, > analyzer, >> true); >> ^ >> 1 error >> >> What i am doing wrong?? >> >> I'm a newbie ... >> >> Thank U >> -- >> View this message in context: >> http://old.nabble.com/index-a-database-tp27358959p27358959.html >> Sent from the Lucene - Java Users mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org >> For additional commands, e-mail: java-user-h...@lucene.apache.org >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > > > -- View this message in context: http://old.nabble.com/index-a--mysql-database-tp27358959p27363463.html Sent from the Lucene - Java Users mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org