lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ronnie Kolehmainen <ronnie.kolehmai...@ub.uu.se>
Subject Re: Document Get question
Date Thu, 24 Aug 2006 15:08:39 GMT
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 do
something similar to the above when you create the document field in the
indexing process.

/Ronnie


Citerar Mag Gam <magawake@gmail.com>:

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




---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message