Mailing List Archive

Unable to create lucene index
I want to create a lucene index and I use the following code :

Analyzer analyzer = new StopAnalyzer();
IndexWriter writer = new IndexWriter( "mydir", analyzer, false );

First it gives me Lock obtain timed out: error.
When I remove the lock file from /tmp and run it, it says segment file not
found.

/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:430)
at org.apache.lucene.store.FSIndexInput.<init>(FSDirectory.java:439)
at
org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:329)
at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:45)
at
org.apache.lucene.index.IndexWriter$1.doBody(IndexWriter.java:264)
at org.apache.lucene.store.Lock$With.run(Lock.java:99)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:259)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:204)
at BuildIndex.main(BuildIndex.java:28)
Re: Unable to create lucene index [ In reply to ]
If you want to create an index, you have to supply the true as the last
constructor argument to IndexWriter. The lock files use some kind of hash
for their ID:s and might very well persist even if you delete the directory.
So, delete new directory (if it ever was created), delete any lockfiles,
change the constructor and try again.

On 10/18/06, Deepa Paranjpe <deepap@yahoo-inc.com> wrote:
>
> I want to create a lucene index and I use the following code :
>
> Analyzer analyzer = new StopAnalyzer();
> IndexWriter writer = new IndexWriter( "mydir", analyzer, false );
>
> First it gives me Lock obtain timed out: error.
> When I remove the lock file from /tmp and run it, it says segment file not
> found.
>
> /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
> :430)
> at org.apache.lucene.store.FSIndexInput.<init>(FSDirectory.java
> :439)
> at
> org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:329)
> at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:45)
> at
> org.apache.lucene.index.IndexWriter$1.doBody(IndexWriter.java:264)
> at org.apache.lucene.store.Lock$With.run(Lock.java:99)
> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java
> :259)
> at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java
> :204)
> at BuildIndex.main(BuildIndex.java:28)
>
>
>
>
>
>