lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From (Steven J. Owens)
Subject Re: Re(2): newbi question
Date Mon, 22 Oct 2001 22:23:56 GMT
[ Charset ISO-8859-1 unsupported, converting... ]
> writes:
> >> public class Search {
> >>   public static void main(String[] args) {
> >> 	try{
> >>     String indexPath = "d:\\org", queryString = "parag";
> >>     Searcher searcher = new IndexSearcher(indexPath);
> >
> >     Hm, are you sure it should be two slashes?  Alternately, try using
> >forward-slashes (java will map // to whatever your system uses, but not
> >necessarily \\).
> Two back-slashes is correct, the first being the Java escape character.

     Hm, well, maybe, maybe not.  Why not avoid guessing and use
either "/" (which java will convert into \ if you're on a windows
system) or File.separator (which is the "right" way to do it, but can
get kind of awkward)?
> Should the path passed to IndexSearcher have a trailing back-slash?

     I don't think so, but I've been away from that bit of my code
for a few weeks (and it's not handy to look at the moment).

>       String indexPath = "d:\\org\\", queryString = "parag";
>       Searcher searcher = new IndexSearcher(indexPath);

     One gotcha I've run into several times wtih file paths is making
sure that the file path works from the command line.  Specifically,
obviously you should make sure that the file path as given works from
your command line.  However, I've also run into gotchas where I was
checking by loading the filepath in my editor, and the editor expanded
the filepath for me, where the java application didn't :-).

Steven J. Owens

View raw message