Hey all, i'm in my first steps in Lucene. I was trying to index some txt files, and my program doesn't construct the term vector files. I would need these files. (.tvd, .tvx, .tvf)
I'm attaching my code so anyone can help me. Thank you all in advance! Sorry if i'm repeating the question, but i couldn't find the answer to it. public void indexFileOrDirectory(String fileName) throws IOException { addFiles(new File(fileName)); int originalNumDocs = writer.numDocs(); for (File f : queue) { FileReader fr = null; try { Document doc = new Document(); fr = new FileReader(f); doc.add(new Field("contents", fr)); doc.add(new Field("path", fileName, Field.Store.YES, Field.Index.NOT_ANALYZED)); String xpto = "xpto1 xpto2 xpto3"; doc.add(new Field("contents2", xpto, Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); writer.addDocument(doc); System.out.println("Added: " + f); } catch (Exception e) { System.out.println("Could not add: " + f); } finally { fr.close(); } --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org For additional commands, e-mail: java-user-h...@lucene.apache.org