You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Srinivasarao Vundavalli <sr...@gmail.com> on 2007/07/31 07:10:06 UTC

Problem in Lucene

Hi,
     I am using nutch index to search in lucene.  One of my classes use
makeStopTable method ( which is deprecated) of class  StopFilter  in
org.apache.lucene.analysis. When I run my program with lucene 2.1.0

~/j2sdk1.4.2/bin/java -classpath .:lucene-core-2.1.0.jar SearchFiles

Exception in thread "main" java.lang.NoSuchMethodError:
org.apache.lucene.analysis.StopFilter.makeStopTable
([Ljava/lang/String;)Ljava/util/Hashtable;
        at GenericLanguageAnalyzer.<init>(GenericLanguageAnalyzer.java:179)
        at SearchFiles.main(SearchFiles.java:110)

So, as that method(makeStopTable) is there in lucene 1.9.1 I run my program
using this version of lucene.

~/j2sdk1.4.2/bin/java -classpath .:lucene-core-1.9.1.jar SearchFiles

This gives me the following where crawl/index is my index directory.  If we
build the index with lucene, there will be a file called 'segments' in the
index directory. But the index i am using is built by nutch. It contains
'segments_3' and 'segments.gen'. So, it gives me the following exception.

Exception in thread "main" java.io.FileNotFoundException:
crawl/index/segments (No such file or directory)
        at java.io.RandomAccessFile.open(Native Method)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:204)
        at org.apache.lucene.store.FSIndexInput$Descriptor.<init>(
FSDirectory.java:425)
        at org.apache.lucene.store.FSIndexInput.<init>(FSDirectory.java:434)
        at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java
:324)
        at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:45)
        at org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java
:148)
        at org.apache.lucene.store.Lock$With.run(Lock.java:109)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:143)
        at org.apache.lucene.index.IndexReader.open(IndexReader.java:127)
        at SearchFiles.main(SearchFiles.java:103)

Please help me to get rid of this exception.
Thanx in advance

Re: Problem in Lucene

Posted by Srinivasarao Vundavalli <sr...@gmail.com>.
The code that is making use of that makeStopFilter is not written by me. It
has read-only permission. So, I can't make any changes to it.

On 7/31/07, Erick Erickson <er...@gmail.com> wrote:
>
> Why not fix your code to be 2.1 compliant instead? For instance,
> StopFilter has a constructor that takes Set and a constructor
> that takes an array of  String for stopwords.
>
> Otherwise, please tell us more about what you are doing with
> MakeStopTable and why making your code 2.1 compliant isn't an option.
>
> Best
> Erick
>
> On 7/31/07, Srinivasarao Vundavalli <sr...@gmail.com> wrote:
> >
> > Hi,
> >      I am using nutch index to search in lucene.  One of my classes use
> > makeStopTable method ( which is deprecated) of class  StopFilter  in
> > org.apache.lucene.analysis. When I run my program with lucene 2.1.0
> >
> > ~/j2sdk1.4.2/bin/java -classpath .:lucene-core-2.1.0.jar SearchFiles
> >
> > Exception in thread "main" java.lang.NoSuchMethodError:
> > org.apache.lucene.analysis.StopFilter.makeStopTable
> > ([Ljava/lang/String;)Ljava/util/Hashtable;
> >         at GenericLanguageAnalyzer.<init>(GenericLanguageAnalyzer.java
> > :179)
> >         at SearchFiles.main(SearchFiles.java:110)
> >
> > So, as that method(makeStopTable) is there in lucene 1.9.1 I run my
> > program
> > using this version of lucene.
> >
> > ~/j2sdk1.4.2/bin/java -classpath .:lucene-core-1.9.1.jar SearchFiles
> >
> > This gives me the following where crawl/index is my index directory.  If
> > we
> > build the index with lucene, there will be a file called 'segments' in
> the
> > index directory. But the index i am using is built by nutch. It contains
> > 'segments_3' and 'segments.gen'. So, it gives me the following
> exception.
> >
> > Exception in thread "main" java.io.FileNotFoundException:
> > crawl/index/segments (No such file or directory)
> >         at java.io.RandomAccessFile.open(Native Method)
> >         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:204)
> >         at org.apache.lucene.store.FSIndexInput$Descriptor.<init>(
> > FSDirectory.java:425)
> >         at org.apache.lucene.store.FSIndexInput.<init>(FSDirectory.java
> > :434)
> >         at org.apache.lucene.store.FSDirectory.openInput(
> FSDirectory.java
> > :324)
> >         at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java
> :45)
> >         at org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java
> > :148)
> >         at org.apache.lucene.store.Lock$With.run(Lock.java:109)
> >         at org.apache.lucene.index.IndexReader.open(IndexReader.java
> :143)
> >         at org.apache.lucene.index.IndexReader.open(IndexReader.java
> :127)
> >         at SearchFiles.main(SearchFiles.java:103)
> >
> > Please help me to get rid of this exception.
> > Thanx in advance
> >
>

Re: Problem in Lucene

Posted by Erick Erickson <er...@gmail.com>.
Why not fix your code to be 2.1 compliant instead? For instance,
StopFilter has a constructor that takes Set and a constructor
that takes an array of  String for stopwords.

Otherwise, please tell us more about what you are doing with
MakeStopTable and why making your code 2.1 compliant isn't an option.

Best
Erick

On 7/31/07, Srinivasarao Vundavalli <sr...@gmail.com> wrote:
>
> Hi,
>      I am using nutch index to search in lucene.  One of my classes use
> makeStopTable method ( which is deprecated) of class  StopFilter  in
> org.apache.lucene.analysis. When I run my program with lucene 2.1.0
>
> ~/j2sdk1.4.2/bin/java -classpath .:lucene-core-2.1.0.jar SearchFiles
>
> Exception in thread "main" java.lang.NoSuchMethodError:
> org.apache.lucene.analysis.StopFilter.makeStopTable
> ([Ljava/lang/String;)Ljava/util/Hashtable;
>         at GenericLanguageAnalyzer.<init>(GenericLanguageAnalyzer.java
> :179)
>         at SearchFiles.main(SearchFiles.java:110)
>
> So, as that method(makeStopTable) is there in lucene 1.9.1 I run my
> program
> using this version of lucene.
>
> ~/j2sdk1.4.2/bin/java -classpath .:lucene-core-1.9.1.jar SearchFiles
>
> This gives me the following where crawl/index is my index directory.  If
> we
> build the index with lucene, there will be a file called 'segments' in the
> index directory. But the index i am using is built by nutch. It contains
> 'segments_3' and 'segments.gen'. So, it gives me the following exception.
>
> Exception in thread "main" java.io.FileNotFoundException:
> crawl/index/segments (No such file or directory)
>         at java.io.RandomAccessFile.open(Native Method)
>         at java.io.RandomAccessFile.<init>(RandomAccessFile.java:204)
>         at org.apache.lucene.store.FSIndexInput$Descriptor.<init>(
> FSDirectory.java:425)
>         at org.apache.lucene.store.FSIndexInput.<init>(FSDirectory.java
> :434)
>         at org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java
> :324)
>         at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:45)
>         at org.apache.lucene.index.IndexReader$1.doBody(IndexReader.java
> :148)
>         at org.apache.lucene.store.Lock$With.run(Lock.java:109)
>         at org.apache.lucene.index.IndexReader.open(IndexReader.java:143)
>         at org.apache.lucene.index.IndexReader.open(IndexReader.java:127)
>         at SearchFiles.main(SearchFiles.java:103)
>
> Please help me to get rid of this exception.
> Thanx in advance
>