Re: Index all the files in a directory

2006-04-30 Thread Erik Hatcher
You are opening a new overwriting IndexWriter for every file, so only the last one is indexed. You should open your IndexWriter outside the loop and close it afterwards. Erik On Apr 30, 2006, at 6:42 AM, Kostas V. wrote: Dear Erick (and everyone who might read my post) hi and than

RE: Index all the files in a directory

2006-04-30 Thread Kostas V.
Dear Erick (and everyone who might read my post) hi and thank you very much for your help. I've tried your program but I do something wrong and it is only index the last txt in the directory. If you could see my problem because I am new to Java and Lucene as well. Thanks in advance Kostas publi

Re: Index all the files in a directory

2006-04-19 Thread Erick Erickson
P.S. if you're not using 1.5..

Re: Index all the files in a directory

2006-04-19 Thread Erick Erickson
Maybe something like this will work It just recursively descends from the root passed to parseAll, processing each .txt file it finds. // Parameter is just the file path of the parent directory. public void parseAll(String sParentDir) throws Exception { indexTree(new File(sPar

RE: Index all the files in a directory

2006-04-19 Thread Kostas V.
Dear Nick, Thank you for your reply, but I still face some problems. I saw the API for FilenameFilter... but I can't instantiate it because it's abstract. The accept method has a parameter name? Where is this? And how I call this method? Finally what are those " : " in the for loop. Sorry but if

RE: Index all the files in a directory

2006-04-13 Thread Nick Vincent
Hi Kostas, I am assuming you need to find all of the text files in the directory. Assuming you're using JDK1.5 you need to do something like this: File directory = new File("c:\my\directory"); FilenameFilter findTextFiles = new FilenameFilter() { public boolean accept(File dir, String nam