score:1

Accepted answer

i don't see any constants you could use in pdftextstream. it would, however, be pretty simple to add it directly to the lucene document that is generated by pdfdocumentfactory before adding it to the index:

doc= pdfdocumentfactory.buildpdfdocument(file, config);

doc.addfield(new stringfield("path", file.getpath(), field.store.yes));

system.out.println(doc.get("path"));
writer.adddocument(doc);

you may want to use a different field type, depending on your needs (stringfield for exact matching, textfield for full text search, storedfield for no searching on that field)


Related Query