Hi Steven,

thanks for your reply.

Here is my szenario:
1) I want to grab a the website "xy.com" to the local disc at C:\xy
2) While exporting I want to index the content to C:\xy\index
3) I put applet.class at C:\xy\index

If I open that applet from the (file) location C:\xy\index it can access any
file in that 
directory with a method like this one. This method reads the content of
sFile.

private String read(String sFileName)
{
    StringBuffer sb = new StringBuffer();
    try
    {
      URL source = new URL(getCodeBase(), sFileName);
      BufferedReader in = new BufferedReader(new
InputStreamReader(source.openStream()));
      while(true)
      {
        String s = in.readLine();
        if(s==null)
          break;
        sb.append(s);
      }
      in.close();
    }
    catch(Exception e)
    {
        //errorhandling
    }
    return sb.toString();
}

It seems to me that the security-constraints of the sandbox do not prevent
me from using an applet 
to open any file in the directory C:\xy\index. With this framework I can
nicely create an applet to
search an exported site.

It would be nice if lucene had the functionality to open content from an
URL. 

Like in this little method above, there should not be any problem reading
the index files from the 
URL and perfom a search with the content of these files?

>if you're retrieving the
>index file from a URL, why not just run the search at that URL?

I cannot run a JVM at C:\xy\index. For this I want to use the browser. This
gives me the possibility to
entirely grab a site and burn it on a CD maybe, and the index will still
work.

Yours,
Christoph Breidert

[EMAIL PROTECTED]

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Gesendet: Sonntag, 25. November 2001 20:27
An: Lucene Users List
Betreff: Re: lucene in applet


Christopher,

> I?m working on a site-grabber to wich I would like to add offline search
> funktionality. I experimented with lucene, and it covers all my needs. I?m
> planning to realize the search functionality with an applet.
> 
> Problem: I cannot access the index created with lucene from my applet. The
> only way to access resources on a remote host (wich could be the
file-system
> as well) is with a stream. 

     This sounds about right.  It's a question of the applet sandbox,
not of lucene itself.

     I've done a little applet work in the past; my general advice is
that a "site-grabber with offline search functionality" is not
compatible with the constraints an applet must run under.
Specifically applets have no access to the local file system, and
applets may only open network connections back to the server they were
downloaded from.

     I strongly suggest you ditch the applet aspect entirely, and
maybe look into sun's Java Web Start, which attempts to give you a
good combination of the features of an applet and an application.
 
> //Something like this
> URL source = new URL(getCodeBase(), "path_to_index");
> BufferedReader in = new BufferedReader(new
> InputStreamReader(source.openStream()));
> ...
> 
> >From what I tested lucene I found that the only possibilities to access
an
> existing index is directly with a 'org.apache.lucene.store.Directory' or a
> 'java.io.File' or a 'java.lang.String' containing the path to the index.

     What you say in this sentence could be rewritten more correctly
as, "it is only possible to access an existing index stored on a disk
by using one of three classes that access the disk."  Do you see the
tautology there?

> It seems to me that maybe lucene should add this possibility to access an
> index?

     You do bring up one interesting possibility, which is that
perhaps Lucene should have some option to retrieve an index file from
a URL.  I'm not sure how wise this would be - if you're retrieving the
index file from a URL, why not just run the search at that URL? - but
it's something to consider.  You should think carefully about what
your goal is, and whether such an approach would help, and do a little
experimentation with the lucene code - after all, you have the source,
so you can create a new class to load an index from some remote
location.  If you have good results, maybe post the code here.

Steven J. Owens
[EMAIL PROTECTED]


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

<<<<<<<<<<<<<<<<<<<<<<<<<<<
sitewaerts GmbH
Hebelstraße 15
D-76133 Karlsruhe

Tel: +49 (721) 920 918 0
Fax: +49 (721) 920 918 29
http://www.sitewaerts.de
>>>>>>>>>>>>>>>>>>>>>>>>>>>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to