Re: Re(2): newbi question

2001-10-22 Thread Steven J. Owens

[ Charset ISO-8859-1 unsupported, converting... ]
> [EMAIL PROTECTED] 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
[EMAIL PROTECTED]



Re(2): newbi question

2001-10-22 Thread Andrew Cottrell

[EMAIL PROTECTED] 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.

Should the path passed to IndexSearcher have a trailing back-slash?

i.e. 

public class Search {
  public static void main(String[] args) {
try{
  String indexPath = "d:\\org\\", queryString = "parag";
  Searcher searcher = new IndexSearcher(indexPath);

Regards,
-Andrew Cottrell