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]
--
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
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
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
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"