Is it possible to get Document Name, instead of its entire path?
Currently, i have something like this:
out.println (doc.get ("path")); // Which gives me /documents/file.txt
Is it possible to get "file.txt"
lto:[EMAIL PROTECTED]
Sent: Thursday, August 24, 2006 9:55 AM
To: java-user@lucene.apache.org
Subject: Document Get question
Is it possible to get Document Name, instead of its entire path?
Currently, i have something like this:
out.println (doc.get ("path")); // Which gives me /docum
Index the "filename" when you are indexing as you did the "path". You
can get it back with doc.get("filename");
suba suresh.
Mag Gam wrote:
Is it possible to get Document Name, instead of its entire path?
Currently, i have something like this:
out.println (doc.get ("path")); // Which gives
If you want to get "file.txt" out of "/documents/file.txt" simply cut of
everything before the last "/":
String path = doc.get("path");
String name = path != null ? path.substring(path.lastIndexOf("/") + 1) :
path;
Otherwise, if you want to store only the name in the index, you will have to d
On 24/08/06, Mag Gam <[EMAIL PROTECTED]> wrote:
Is it possible to get Document Name, instead of its entire path?
Currently, i have something like this:
out.println (doc.get ("path")); // Which gives me /documents/file.txt
doc.get("path").split("/")[doc.get("path").split("/").length - 1]
--