Document Get question

2006-08-24 Thread Mag Gam
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"

RE: Document Get question

2006-08-24 Thread Mordo, Aviran (EXP N-NANNATEK)
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

Re: Document Get question

2006-08-24 Thread Suba Suresh
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

Re: Document Get question

2006-08-24 Thread Ronnie Kolehmainen
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

Re: Document Get question

2006-08-26 Thread Hasan Diwan
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] --