I’m trying to index and STORE file content (plain text), but it seems using that way it isn’t possible:
protected Document getDocument(File f) throws Exception {
Document doc = new Document();
Field contents = new Field("contents", new FileReader(f));
Field filename = new Field("filename", f.getName(), Field.Store.YES, Field.Index.ANALYZED);
doc.add(contents);
return doc;
}
How to store content of plain text file (without any tags)?
Just read the file contents and use another Field constructor, something like