Re: XML Indexing

2004-10-05 Thread Simon mcIlwaine
Check this article out.

http://www-106.ibm.com/developerworks/library/j-lucene/

Simon

- Original Message - 
From: Sumathi [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 05, 2004 2:02 PM
Subject: XML Indexing


  Can any one give me a demo for indexing XML files ?
  Mit freundlichen GrĂ¼ssen - with kind regards
  _


  Sumathi P

  Junior Consultant QA

  GFT Technologies , India

  95 , Bharathidasan Salai
  Cantonment , Trichy-620001
  TamilNadu , India

  T +91-431-2418 398
  F +91-431-2418 698

  [EMAIL PROTECTED]

  www.gft.com



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



Re: Lucene Search Applet

2004-08-25 Thread Simon mcIlwaine
Hi Jon,

Where do I go to get the attached files?

Many Thanks

Simon

- Original Message - 
From: Jon Schuster [EMAIL PROTECTED]
To: 'Lucene Users List' [EMAIL PROTECTED]
Sent: Monday, August 23, 2004 6:25 PM
Subject: RE: Lucene Search Applet


 Hi all,

 The changes I made to get past the System.getProperty issues are
essentially
 the same in the three files org.apache.lucene.index.IndexWriter,
 org.apache.lucene.store.FSDirectory, and
 org.apache.lucene.search.BooleanQuery.

 Change the static initializations from a form like this:

   public static long WRITE_LOCK_TIMEOUT =

 Integer.parseInt(System.getProperty(org.apache.lucene.writeLockTimeout,
   1000));

 to a separate declaration and static initializer block like this:

public static long WRITE_LOCK_TIMEOUT;
static
{
 try
 {
 WRITE_LOCK_TIMEOUT =
 Integer.parseInt(System.getProperty(org.apache.lucene.writeLockTimeout,
 1000));
 }
 catch ( Exception e )
 {
 WRITE_LOCK_TIMEOUT = 1000;
 }
};

 As before, the variables are initialized when the class is loaded, but if
 the System.getProperty fails, the variable still gets initialized to its
 default value in the catch block.

 You can use a separate static block for each variable, or put them all
into
 a single static block. You could also add a setter for each variable if
you
 want the ability to set the value separately from the class init.

 In the FSDirectory class, the variables DISABLE_LOCKS and LOCK_DIR are
 marked final, which I had to remove to do the initialization as described.

 I've also attached the three modified files if you want to just copy and
 paste.

 --Jon

 -Original Message-
 From: Simon mcIlwaine [mailto:[EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 7:37 AM
 To: Lucene Users List
 Subject: Re: Lucene Search Applet

 Hi,

 Just used the RODirectory and I'm now getting the following error:
 java.security.AccessControlException: access denied
 (java.util.PropertyPermission user.dir read) I'm reckoning that this is
what
 Jon was on about with System.getProperty() within certain files because im
 using an applet. Is this correct and if so can someone show me one of the
 hacked files so that I know what I need to modify.

 Many Thanks

 Simon
 .
 - Original Message -
 From: Simon mcIlwaine [EMAIL PROTECTED]
 To: Lucene Users List [EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 3:12 PM
 Subject: Re: Lucene Search Applet

  Hi Stephane,
 
  A bit of a stupid question but how do you mean set the system property
  disableLuceneLocks=true? Can I do it from a call from FSDirectory API or
 do
  I have to actually hack the code? Also if I do use RODirectory how do I
go
  about using it? Do I have to update the Lucene JAR archive file with
  RODirectory class included as I tried using it and its not recognising
the
  class?
 
  Many Thanks
 
  Simon
 
  - Original Message -
  From: Stephane James Vaucher [EMAIL PROTECTED]
  To: Lucene Users List [EMAIL PROTECTED]
  Sent: Monday, August 23, 2004 2:22 PM
  Subject: Re: Lucene Search Applet
 
 
   Hi Simon,
  
   Does this work? From FSDirectory api:
  
   If the system property 'disableLuceneLocks' has the String value of
   true, lock creation will be disabled.
  
   Otherwise, I think there was a Read-Only Directory hack:
  
  
http://www.mail-archive.com/[EMAIL PROTECTED]/msg05148.html
  
   HTH,
   sv
  
   On Mon, 23 Aug 2004, Simon mcIlwaine wrote:
  
Thanks Jon that works by putting the jar file in the archive
 attribute.
  Now
im getting the disablelock error cause of the unsigned applet. Do I
 just
comment out the code anywhere where System.getProperty() appears in
 the
files that you specified and then update the JAR Archive?? Is it
  possible
you could show me one of the hacked files so that I know what I'm
  modifying?
Does anyone else know if there is another way of doing this without
  having
to hack the source code?
   
Many thanks.
   
Simon
   
- Original Message -
From: Jon Schuster [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 2:08 AM
Subject: Re: Lucene Search Applet
   
   
 I have Lucene working in an applet and I've seen this problem only
  when
 the jar file really was not available (typo in the jar name),
which
 is
 what you'd expect. It's possible that the classpath for your
 application is not the same as the classpath for the applet;
perhaps
 they're using different VMs or JREs from different locations.

 Try referencing the Lucene jar file in the archive attribute of
the
 applet tag.

 Also, to get Lucene to work from an unsigned applet, I had to
modify
 a
 few classes that call System.getProperty(), because the properties
  that
 were being requested were disallowed for applets. I think the
 classes
 were IndexWriter, FSDirectory, and BooleanQuery.

 --Jon

Re: Lucene Search Applet

2004-08-25 Thread Simon mcIlwaine
Hi Jon,

I modified the three files exactly the way you said using separate
declaration and static initializer block but for IndexWriter I had to change
4 of the variables because they were final. Then I updated the Lucene JAR
file with the three files in the appropriate directory. But i'm still
getting the error: java.security.AccessControlException: access denied
(java.util.PropertyPermission user.dir read)?? What am I doing wrong? The
last mail you sent I was unable to download the files you attached. Is it
possible you could send them to my work address: [EMAIL PROTECTED]

Many Thanks

Simon


- Original Message - 
From: Jon Schuster [EMAIL PROTECTED]
To: 'Lucene Users List' [EMAIL PROTECTED]
Sent: Monday, August 23, 2004 6:25 PM
Subject: RE: Lucene Search Applet


 Hi all,

 The changes I made to get past the System.getProperty issues are
essentially
 the same in the three files org.apache.lucene.index.IndexWriter,
 org.apache.lucene.store.FSDirectory, and
 org.apache.lucene.search.BooleanQuery.

 Change the static initializations from a form like this:

   public static long WRITE_LOCK_TIMEOUT =

 Integer.parseInt(System.getProperty(org.apache.lucene.writeLockTimeout,
   1000));

 to a separate declaration and static initializer block like this:

public static long WRITE_LOCK_TIMEOUT;
static
{
 try
 {
 WRITE_LOCK_TIMEOUT =
 Integer.parseInt(System.getProperty(org.apache.lucene.writeLockTimeout,
 1000));
 }
 catch ( Exception e )
 {
 WRITE_LOCK_TIMEOUT = 1000;
 }
};

 As before, the variables are initialized when the class is loaded, but if
 the System.getProperty fails, the variable still gets initialized to its
 default value in the catch block.

 You can use a separate static block for each variable, or put them all
into
 a single static block. You could also add a setter for each variable if
you
 want the ability to set the value separately from the class init.

 In the FSDirectory class, the variables DISABLE_LOCKS and LOCK_DIR are
 marked final, which I had to remove to do the initialization as described.

 I've also attached the three modified files if you want to just copy and
 paste.

 --Jon

 -Original Message-
 From: Simon mcIlwaine [mailto:[EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 7:37 AM
 To: Lucene Users List
 Subject: Re: Lucene Search Applet

 Hi,

 Just used the RODirectory and I'm now getting the following error:
 java.security.AccessControlException: access denied
 (java.util.PropertyPermission user.dir read) I'm reckoning that this is
what
 Jon was on about with System.getProperty() within certain files because im
 using an applet. Is this correct and if so can someone show me one of the
 hacked files so that I know what I need to modify.

 Many Thanks

 Simon
 .
 - Original Message -
 From: Simon mcIlwaine [EMAIL PROTECTED]
 To: Lucene Users List [EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 3:12 PM
 Subject: Re: Lucene Search Applet

  Hi Stephane,
 
  A bit of a stupid question but how do you mean set the system property
  disableLuceneLocks=true? Can I do it from a call from FSDirectory API or
 do
  I have to actually hack the code? Also if I do use RODirectory how do I
go
  about using it? Do I have to update the Lucene JAR archive file with
  RODirectory class included as I tried using it and its not recognising
the
  class?
 
  Many Thanks
 
  Simon
 
  - Original Message -
  From: Stephane James Vaucher [EMAIL PROTECTED]
  To: Lucene Users List [EMAIL PROTECTED]
  Sent: Monday, August 23, 2004 2:22 PM
  Subject: Re: Lucene Search Applet
 
 
   Hi Simon,
  
   Does this work? From FSDirectory api:
  
   If the system property 'disableLuceneLocks' has the String value of
   true, lock creation will be disabled.
  
   Otherwise, I think there was a Read-Only Directory hack:
  
  
http://www.mail-archive.com/[EMAIL PROTECTED]/msg05148.html
  
   HTH,
   sv
  
   On Mon, 23 Aug 2004, Simon mcIlwaine wrote:
  
Thanks Jon that works by putting the jar file in the archive
 attribute.
  Now
im getting the disablelock error cause of the unsigned applet. Do I
 just
comment out the code anywhere where System.getProperty() appears in
 the
files that you specified and then update the JAR Archive?? Is it
  possible
you could show me one of the hacked files so that I know what I'm
  modifying?
Does anyone else know if there is another way of doing this without
  having
to hack the source code?
   
Many thanks.
   
Simon
   
- Original Message -
From: Jon Schuster [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 2:08 AM
Subject: Re: Lucene Search Applet
   
   
 I have Lucene working in an applet and I've seen this problem only
  when
 the jar file really was not available (typo in the jar name),
which
 is
 what you'd expect. It's possible that the classpath for your
 application

Re: Lucene Search Applet

2004-08-23 Thread Simon mcIlwaine
Thanks Jon that works by putting the jar file in the archive attribute. Now
im getting the disablelock error cause of the unsigned applet. Do I just
comment out the code anywhere where System.getProperty() appears in the
files that you specified and then update the JAR Archive?? Is it possible
you could show me one of the hacked files so that I know what I'm modifying?
Does anyone else know if there is another way of doing this without having
to hack the source code?

Many thanks.

Simon

- Original Message - 
From: Jon Schuster [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 2:08 AM
Subject: Re: Lucene Search Applet


 I have Lucene working in an applet and I've seen this problem only when
 the jar file really was not available (typo in the jar name), which is
 what you'd expect. It's possible that the classpath for your
 application is not the same as the classpath for the applet; perhaps
 they're using different VMs or JREs from different locations.

 Try referencing the Lucene jar file in the archive attribute of the
 applet tag.

 Also, to get Lucene to work from an unsigned applet, I had to modify a
 few classes that call System.getProperty(), because the properties that
 were being requested were disallowed for applets. I think the classes
 were IndexWriter, FSDirectory, and BooleanQuery.

 --Jon


 On Aug 20, 2004, at 6:57 AM, Simon mcIlwaine wrote:

  Im a new Lucene User and I'm not too familiar with Applets either but
  I've
  been doing a bit of testing on java applet security and if im correct
  in
  saying that applets can read anything below there codebase then my
  problem
  is not a security restriction one. The error is reading
  java.lang.NoClassDefFoundError and the classpath is set as I have it
  working
  in a Swing App. Does someone actually have Lucene working in an
  Applet? Can
  it be done?? Please help.
 
  Thanks
 
  Simon
 
  - Original Message -
 
  From: Terry Steichen [EMAIL PROTECTED]
  To: Lucene Users List [EMAIL PROTECTED]
  Sent: Wednesday, August 18, 2004 4:17 PM
  Subject: Re: Lucene Search Applet
 
 
  I suspect it has to do with the security restrictions of the applet,
  'cause
  it doesn't appear to be finding your Lucene jar file.  Also, regarding
  the
  lock files, I believe you can disable the locking stuff just for
  purposes
  like yours (read-only index).
 
  Regards,
 
  Terry
- Original Message -
From: Simon mcIlwaine
To: Lucene Users List
Sent: Wednesday, August 18, 2004 11:03 AM
Subject: Lucene Search Applet
 
 
Im developing a Lucene CD-ROM based search which will search html
  pages on
  CD-ROM, using an applet as the UI. I know that theres a problem with
  lock
  files and also security restrictions on applets so I am using the
  RAMDirectory. I have it working in a Swing application however when I
  put it
  into an applet its giving me problems. It compiles but when I go to
  run the
  applet I get the error below. Can anyone help? Thanks in advance.
Simon
 
Error:
 
Java.lang.noClassDefFoundError: org/apache/lucene/store/Directory
 
At: Java.lang.Class.getDeclaredConstructors0(Native Method)
 
At: Java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
 
At: Java.lang.Class.getConstructor0(Class.java:1922)
 
At: Java.lang.Class.newInstance0(Class.java:278)
 
At: Java.lang.Class.newInstance(Class.java:261)
 
At: sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
 
At: sun.applet.AppletPanel.runloader(AppletPanel.java:546)
 
At: sun.applet.AppletPanel.run(AppletPanel.java:298)
 
At: java.lang.Thread.run(Thread.java:534)
 
Code:
 
import org.apache.lucene.search.IndexSearcher;
 
import org.apache.lucene.search.Query;
 
import org.apache.lucene.search.TermQuery;
 
import org.apache.lucene.store.RAMDirectory;
 
import org.apache.lucene.store.Directory;
 
import org.apache.lucene.index.Term;
 
import org.apache.lucene.search.Hits;
 
import java.awt.*;
 
import java.awt.event.*;
 
import javax.swing.*;
 
import java.io.*;
 
public class MemorialApp2 extends JApplet implements ActionListener{
 
JLabel prompt;
 
JTextField input;
 
JButton search;
 
JPanel panel;
 
String indexDir = C:/Java/lucene/index-list;
 
private static RAMDirectory idx;
 
public void init(){
 
Container cp = getContentPane();
 
panel = new JPanel();
 
panel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));
 
prompt = new JLabel(Keyword search:);
 
input = new JTextField(,20);
 
search = new JButton(Search);
 
search.addActionListener(this);
 
panel.add(prompt);
 
panel.add(input);
 
panel.add(search);
 
cp.add(panel);
 
}
 
public void actionPerformed(ActionEvent e){
 
if (e.getSource() == search){
 
String surname = (input.getText());
 
try {
 
findSurname(indexDir, surname

Re: Lucene Search Applet

2004-08-23 Thread Simon mcIlwaine
Hi Stephane,

A bit of a stupid question but how do you mean set the system property
disableLuceneLocks=true? Can I do it from a call from FSDirectory API or do
I have to actually hack the code? Also if I do use RODirectory how do I go
about using it? Do I have to update the Lucene JAR archive file with
RODirectory class included as I tried using it and its not recognising the
class?

Many Thanks

Simon

- Original Message - 
From: Stephane James Vaucher [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Monday, August 23, 2004 2:22 PM
Subject: Re: Lucene Search Applet


 Hi Simon,

 Does this work? From FSDirectory api:

 If the system property 'disableLuceneLocks' has the String value of
 true, lock creation will be disabled.

 Otherwise, I think there was a Read-Only Directory hack:

 http://www.mail-archive.com/[EMAIL PROTECTED]/msg05148.html

 HTH,
 sv

 On Mon, 23 Aug 2004, Simon mcIlwaine wrote:

  Thanks Jon that works by putting the jar file in the archive attribute.
Now
  im getting the disablelock error cause of the unsigned applet. Do I just
  comment out the code anywhere where System.getProperty() appears in the
  files that you specified and then update the JAR Archive?? Is it
possible
  you could show me one of the hacked files so that I know what I'm
modifying?
  Does anyone else know if there is another way of doing this without
having
  to hack the source code?
 
  Many thanks.
 
  Simon
 
  - Original Message - 
  From: Jon Schuster [EMAIL PROTECTED]
  To: Lucene Users List [EMAIL PROTECTED]
  Sent: Saturday, August 21, 2004 2:08 AM
  Subject: Re: Lucene Search Applet
 
 
   I have Lucene working in an applet and I've seen this problem only
when
   the jar file really was not available (typo in the jar name), which is
   what you'd expect. It's possible that the classpath for your
   application is not the same as the classpath for the applet; perhaps
   they're using different VMs or JREs from different locations.
  
   Try referencing the Lucene jar file in the archive attribute of the
   applet tag.
  
   Also, to get Lucene to work from an unsigned applet, I had to modify a
   few classes that call System.getProperty(), because the properties
that
   were being requested were disallowed for applets. I think the classes
   were IndexWriter, FSDirectory, and BooleanQuery.
  
   --Jon
  
  
   On Aug 20, 2004, at 6:57 AM, Simon mcIlwaine wrote:
  
Im a new Lucene User and I'm not too familiar with Applets either
but
I've
been doing a bit of testing on java applet security and if im
correct
in
saying that applets can read anything below there codebase then my
problem
is not a security restriction one. The error is reading
java.lang.NoClassDefFoundError and the classpath is set as I have it
working
in a Swing App. Does someone actually have Lucene working in an
Applet? Can
it be done?? Please help.
   
Thanks
   
Simon
   
- Original Message -
   
From: Terry Steichen [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 4:17 PM
Subject: Re: Lucene Search Applet
   
   
I suspect it has to do with the security restrictions of the applet,
'cause
it doesn't appear to be finding your Lucene jar file.  Also,
regarding
the
lock files, I believe you can disable the locking stuff just for
purposes
like yours (read-only index).
   
Regards,
   
Terry
  - Original Message -
  From: Simon mcIlwaine
  To: Lucene Users List
  Sent: Wednesday, August 18, 2004 11:03 AM
  Subject: Lucene Search Applet
   
   
  Im developing a Lucene CD-ROM based search which will search html
pages on
CD-ROM, using an applet as the UI. I know that theres a problem with
lock
files and also security restrictions on applets so I am using the
RAMDirectory. I have it working in a Swing application however when
I
put it
into an applet its giving me problems. It compiles but when I go to
run the
applet I get the error below. Can anyone help? Thanks in advance.
  Simon
   
  Error:
   
  Java.lang.noClassDefFoundError: org/apache/lucene/store/Directory
   
  At: Java.lang.Class.getDeclaredConstructors0(Native Method)
   
  At:
Java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
   
  At: Java.lang.Class.getConstructor0(Class.java:1922)
   
  At: Java.lang.Class.newInstance0(Class.java:278)
   
  At: Java.lang.Class.newInstance(Class.java:261)
   
  At: sun.applet.AppletPanel.createApplet(AppletPanel.java:617)
   
  At: sun.applet.AppletPanel.runloader(AppletPanel.java:546)
   
  At: sun.applet.AppletPanel.run(AppletPanel.java:298)
   
  At: java.lang.Thread.run(Thread.java:534)
   
  Code:
   
  import org.apache.lucene.search.IndexSearcher;
   
  import org.apache.lucene.search.Query;
   
  import

Re: Lucene Search Applet

2004-08-23 Thread Simon mcIlwaine
Hi,

Just used the RODirectory and I'm now getting the following error:
java.security.AccessControlException: access denied
(java.util.PropertyPermission user.dir read) I'm reckoning that this is what
Jon was on about with System.getProperty() within certain files because im
using an applet. Is this correct and if so can someone show me one of the
hacked files so that I know what I need to modify.

Many Thanks

Simon
.
- Original Message -
From: Simon mcIlwaine [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Monday, August 23, 2004 3:12 PM
Subject: Re: Lucene Search Applet

 Hi Stephane,

 A bit of a stupid question but how do you mean set the system property
 disableLuceneLocks=true? Can I do it from a call from FSDirectory API or
do
 I have to actually hack the code? Also if I do use RODirectory how do I go
 about using it? Do I have to update the Lucene JAR archive file with
 RODirectory class included as I tried using it and its not recognising the
 class?

 Many Thanks

 Simon

 - Original Message -
 From: Stephane James Vaucher [EMAIL PROTECTED]
 To: Lucene Users List [EMAIL PROTECTED]
 Sent: Monday, August 23, 2004 2:22 PM
 Subject: Re: Lucene Search Applet


  Hi Simon,
 
  Does this work? From FSDirectory api:
 
  If the system property 'disableLuceneLocks' has the String value of
  true, lock creation will be disabled.
 
  Otherwise, I think there was a Read-Only Directory hack:
 
  http://www.mail-archive.com/[EMAIL PROTECTED]/msg05148.html
 
  HTH,
  sv
 
  On Mon, 23 Aug 2004, Simon mcIlwaine wrote:
 
   Thanks Jon that works by putting the jar file in the archive
attribute.
 Now
   im getting the disablelock error cause of the unsigned applet. Do I
just
   comment out the code anywhere where System.getProperty() appears in
the
   files that you specified and then update the JAR Archive?? Is it
 possible
   you could show me one of the hacked files so that I know what I'm
 modifying?
   Does anyone else know if there is another way of doing this without
 having
   to hack the source code?
  
   Many thanks.
  
   Simon
  
   - Original Message -
   From: Jon Schuster [EMAIL PROTECTED]
   To: Lucene Users List [EMAIL PROTECTED]
   Sent: Saturday, August 21, 2004 2:08 AM
   Subject: Re: Lucene Search Applet
  
  
I have Lucene working in an applet and I've seen this problem only
 when
the jar file really was not available (typo in the jar name), which
is
what you'd expect. It's possible that the classpath for your
application is not the same as the classpath for the applet; perhaps
they're using different VMs or JREs from different locations.
   
Try referencing the Lucene jar file in the archive attribute of the
applet tag.
   
Also, to get Lucene to work from an unsigned applet, I had to modify
a
few classes that call System.getProperty(), because the properties
 that
were being requested were disallowed for applets. I think the
classes
were IndexWriter, FSDirectory, and BooleanQuery.
   
--Jon
   
   
On Aug 20, 2004, at 6:57 AM, Simon mcIlwaine wrote:
   
 Im a new Lucene User and I'm not too familiar with Applets either
 but
 I've
 been doing a bit of testing on java applet security and if im
 correct
 in
 saying that applets can read anything below there codebase then my
 problem
 is not a security restriction one. The error is reading
 java.lang.NoClassDefFoundError and the classpath is set as I have
it
 working
 in a Swing App. Does someone actually have Lucene working in an
 Applet? Can
 it be done?? Please help.

 Thanks

 Simon

 - Original Message -

 From: Terry Steichen [EMAIL PROTECTED]
 To: Lucene Users List [EMAIL PROTECTED]
 Sent: Wednesday, August 18, 2004 4:17 PM
 Subject: Re: Lucene Search Applet


 I suspect it has to do with the security restrictions of the
applet,
 'cause
 it doesn't appear to be finding your Lucene jar file.  Also,
 regarding
 the
 lock files, I believe you can disable the locking stuff just for
 purposes
 like yours (read-only index).

 Regards,

 Terry
   - Original Message -
   From: Simon mcIlwaine
   To: Lucene Users List
   Sent: Wednesday, August 18, 2004 11:03 AM
   Subject: Lucene Search Applet


   Im developing a Lucene CD-ROM based search which will search
html
 pages on
 CD-ROM, using an applet as the UI. I know that theres a problem
with
 lock
 files and also security restrictions on applets so I am using the
 RAMDirectory. I have it working in a Swing application however
when
 I
 put it
 into an applet its giving me problems. It compiles but when I go
to
 run the
 applet I get the error below. Can anyone help? Thanks in advance.
   Simon

   Error:

   Java.lang.noClassDefFoundError:
org/apache/lucene

Re: Lucene Search Applet

2004-08-20 Thread Simon mcIlwaine
Im a new Lucene User and I'm not too familiar with Applets either but I've
been doing a bit of testing on java applet security and if im correct in
saying that applets can read anything below there codebase then my problem
is not a security restriction one. The error is reading
java.lang.NoClassDefFoundError and the classpath is set as I have it working
in a Swing App. Does someone actually have Lucene working in an Applet? Can
it be done?? Please help.

Thanks

Simon

- Original Message - 

From: Terry Steichen [EMAIL PROTECTED]
To: Lucene Users List [EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 4:17 PM
Subject: Re: Lucene Search Applet


I suspect it has to do with the security restrictions of the applet, 'cause
it doesn't appear to be finding your Lucene jar file.  Also, regarding the
lock files, I believe you can disable the locking stuff just for purposes
like yours (read-only index).

Regards,

Terry
  - Original Message - 
  From: Simon mcIlwaine
  To: Lucene Users List
  Sent: Wednesday, August 18, 2004 11:03 AM
  Subject: Lucene Search Applet


  Im developing a Lucene CD-ROM based search which will search html pages on
CD-ROM, using an applet as the UI. I know that theres a problem with lock
files and also security restrictions on applets so I am using the
RAMDirectory. I have it working in a Swing application however when I put it
into an applet its giving me problems. It compiles but when I go to run the
applet I get the error below. Can anyone help? Thanks in advance.
  Simon

  Error:

  Java.lang.noClassDefFoundError: org/apache/lucene/store/Directory

  At: Java.lang.Class.getDeclaredConstructors0(Native Method)

  At: Java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)

  At: Java.lang.Class.getConstructor0(Class.java:1922)

  At: Java.lang.Class.newInstance0(Class.java:278)

  At: Java.lang.Class.newInstance(Class.java:261)

  At: sun.applet.AppletPanel.createApplet(AppletPanel.java:617)

  At: sun.applet.AppletPanel.runloader(AppletPanel.java:546)

  At: sun.applet.AppletPanel.run(AppletPanel.java:298)

  At: java.lang.Thread.run(Thread.java:534)

  Code:

  import org.apache.lucene.search.IndexSearcher;

  import org.apache.lucene.search.Query;

  import org.apache.lucene.search.TermQuery;

  import org.apache.lucene.store.RAMDirectory;

  import org.apache.lucene.store.Directory;

  import org.apache.lucene.index.Term;

  import org.apache.lucene.search.Hits;

  import java.awt.*;

  import java.awt.event.*;

  import javax.swing.*;

  import java.io.*;

  public class MemorialApp2 extends JApplet implements ActionListener{

  JLabel prompt;

  JTextField input;

  JButton search;

  JPanel panel;

  String indexDir = C:/Java/lucene/index-list;

  private static RAMDirectory idx;

  public void init(){

  Container cp = getContentPane();

  panel = new JPanel();

  panel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));

  prompt = new JLabel(Keyword search:);

  input = new JTextField(,20);

  search = new JButton(Search);

  search.addActionListener(this);

  panel.add(prompt);

  panel.add(input);

  panel.add(search);

  cp.add(panel);

  }

  public void actionPerformed(ActionEvent e){

  if (e.getSource() == search){

  String surname = (input.getText());

  try {

  findSurname(indexDir, surname);

  } catch(Exception ex) {

  System.err.println(ex);

  }

  }

  }

  public static void findSurname(String indexDir, String surname) throws
Exception{

  idx = new RAMDirectory(indexDir);

  IndexSearcher searcher = new IndexSearcher(idx);

  Query query = new TermQuery(new Term(surname, surname));

  Hits hits = searcher.search(query);

  for (int i = 0; i  hits.length(); i++) {

  //Document doc = hits.doc(i);

  System.out.println(Surname:  + hits.doc(i).get(surname));

  }

  }

  }



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



Lucene Search Applet

2004-08-18 Thread Simon mcIlwaine
Im developing a Lucene CD-ROM based search which will search html pages on CD-ROM, 
using an applet as the UI. I know that theres a problem with lock files and also 
security restrictions on applets so I am using the RAMDirectory. I have it working in 
a Swing application however when I put it into an applet its giving me problems. It 
compiles but when I go to run the applet I get the error below. Can anyone help? 
Thanks in advance.
Simon

Error:

Java.lang.noClassDefFoundError: org/apache/lucene/store/Directory

At: Java.lang.Class.getDeclaredConstructors0(Native Method)

At: Java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)

At: Java.lang.Class.getConstructor0(Class.java:1922)

At: Java.lang.Class.newInstance0(Class.java:278)

At: Java.lang.Class.newInstance(Class.java:261)

At: sun.applet.AppletPanel.createApplet(AppletPanel.java:617)

At: sun.applet.AppletPanel.runloader(AppletPanel.java:546)

At: sun.applet.AppletPanel.run(AppletPanel.java:298)

At: java.lang.Thread.run(Thread.java:534)

Code:

import org.apache.lucene.search.IndexSearcher;

import org.apache.lucene.search.Query;

import org.apache.lucene.search.TermQuery;

import org.apache.lucene.store.RAMDirectory;

import org.apache.lucene.store.Directory;

import org.apache.lucene.index.Term;

import org.apache.lucene.search.Hits;

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import java.io.*;

public class MemorialApp2 extends JApplet implements ActionListener{

JLabel prompt;

JTextField input;

JButton search;

JPanel panel;

String indexDir = C:/Java/lucene/index-list;

private static RAMDirectory idx;

public void init(){

Container cp = getContentPane();

panel = new JPanel();

panel.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 4));

prompt = new JLabel(Keyword search:);

input = new JTextField(,20);

search = new JButton(Search);

search.addActionListener(this);

panel.add(prompt);

panel.add(input);

panel.add(search);

cp.add(panel);

}

public void actionPerformed(ActionEvent e){

if (e.getSource() == search){

String surname = (input.getText());

try {

findSurname(indexDir, surname);

} catch(Exception ex) {

System.err.println(ex);

}

}

}

public static void findSurname(String indexDir, String surname) throws Exception{

idx = new RAMDirectory(indexDir);

IndexSearcher searcher = new IndexSearcher(idx);

Query query = new TermQuery(new Term(surname, surname));

Hits hits = searcher.search(query);

for (int i = 0; i  hits.length(); i++) {

//Document doc = hits.doc(i);

System.out.println(Surname:  + hits.doc(i).get(surname));

}

}

}