Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

Help me with this error on indexing

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


fabriciorsf at gmail

Nov 20, 2009, 11:18 AM

Post #1 of 5 (556 views)
Permalink
Help me with this error on indexing

Hi,

I am evaluating several search algoritms, and I iterate on each. In each
interation I delete the index directory, index the docs and I run the
evaluation on the algoritm. The end of the iteration I close the
indexReader.

Then, in the second iteration the following error occurs int the doc 1154
indexing:

adding docs\1148
adding docs\1149
adding docs\1150
adding docs\1151
adding docs\1152
adding docs\1153
adding docs\1154
java.io.IOException: Cannot overwrite: index\_zk.cfs
at org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362)
at
org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58)
at
org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150)
at
org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618)
at
org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320)
at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174)
at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165)
at
org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118)
at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096)

This is the code:

public void addDocument(Document doc) throws CorruptIndexException,
IOException {
synchronized (getIndexWriter()) {
getIndexWriter().addDocument(doc);
getIndexWriter().commit();
}
}


Can any help me?

Now Thanks!

--
Fabrício Raphael Silva Ferreira


erickerickson at gmail

Nov 20, 2009, 4:14 PM

Post #2 of 5 (535 views)
Permalink
Re: Help me with this error on indexing [In reply to]

What operating system are you running on? This sounds like Windows behavior
when some other process is holding the file open.....

Erick

2009/11/20 Fabrício Raphael <fabriciorsf [at] gmail>

> Hi,
>
> I am evaluating several search algoritms, and I iterate on each. In each
> interation I delete the index directory, index the docs and I run the
> evaluation on the algoritm. The end of the iteration I close the
> indexReader.
>
> Then, in the second iteration the following error occurs int the doc 1154
> indexing:
>
> adding docs\1148
> adding docs\1149
> adding docs\1150
> adding docs\1151
> adding docs\1152
> adding docs\1153
> adding docs\1154
> java.io.IOException: Cannot overwrite: index\_zk.cfs
> at org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362)
> at
>
> org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58)
> at
>
> org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150)
> at
>
> org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618)
> at
> org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320)
> at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174)
> at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165)
> at
> org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055)
> at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118)
> at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096)
>
> This is the code:
>
> public void addDocument(Document doc) throws CorruptIndexException,
> IOException {
> synchronized (getIndexWriter()) {
> getIndexWriter().addDocument(doc);
> getIndexWriter().commit();
> }
> }
>
>
> Can any help me?
>
> Now Thanks!
>
> --
> Fabrício Raphael Silva Ferreira
>


fabriciorsf at gmail

Nov 20, 2009, 5:27 PM

Post #3 of 5 (524 views)
Permalink
Re: Help me with this error on indexing [In reply to]

This hapened only on Windows, on Ubuntu it don't happen.

And I corrected this problem by removing the commit, and put it in the end
of the addition of all documents.

On Fri, Nov 20, 2009 at 9:14 PM, Erick Erickson <erickerickson [at] gmail>wrote:

> What operating system are you running on? This sounds like Windows behavior
> when some other process is holding the file open.....
>
> Erick
>
> 2009/11/20 Fabrício Raphael <fabriciorsf [at] gmail>
>
> > Hi,
> >
> > I am evaluating several search algoritms, and I iterate on each. In each
> > interation I delete the index directory, index the docs and I run the
> > evaluation on the algoritm. The end of the iteration I close the
> > indexReader.
> >
> > Then, in the second iteration the following error occurs int the doc 1154
> > indexing:
> >
> > adding docs\1148
> > adding docs\1149
> > adding docs\1150
> > adding docs\1151
> > adding docs\1152
> > adding docs\1153
> > adding docs\1154
> > java.io.IOException: Cannot overwrite: index\_zk.cfs
> > at
> org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362)
> > at
> >
> >
> org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58)
> > at
> >
> >
> org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150)
> > at
> >
> >
> org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618)
> > at
> >
> org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320)
> > at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174)
> > at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165)
> > at
> > org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055)
> > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118)
> > at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096)
> >
> > This is the code:
> >
> > public void addDocument(Document doc) throws CorruptIndexException,
> > IOException {
> > synchronized (getIndexWriter()) {
> > getIndexWriter().addDocument(doc);
> > getIndexWriter().commit();
> > }
> > }
> >
> >
> > Can any help me?
> >
> > Now Thanks!
> >
> > --
> > Fabrício Raphael Silva Ferreira
> >
>



--
Fabrício Raphael


simon.willnauer at googlemail

Nov 21, 2009, 1:46 AM

Post #4 of 5 (515 views)
Permalink
Re: Help me with this error on indexing [In reply to]

Try to switch you AntiVirus SW off I you have any.

simon

2009/11/21 Fabrício Raphael <fabriciorsf [at] gmail>:
> This hapened only on Windows, on Ubuntu it don't happen.
>
> And I corrected this problem by removing the commit, and put it in the end
> of the addition of all documents.
>
> On Fri, Nov 20, 2009 at 9:14 PM, Erick Erickson <erickerickson [at] gmail>wrote:
>
>> What operating system are you running on? This sounds like Windows behavior
>> when some other process is holding the file open.....
>>
>> Erick
>>
>> 2009/11/20 Fabrício Raphael <fabriciorsf [at] gmail>
>>
>> > Hi,
>> >
>> > I am evaluating several search algoritms, and I iterate on each. In each
>> > interation I delete the index directory, index the docs and I run the
>> > evaluation on the algoritm. The end of the iteration I close the
>> > indexReader.
>> >
>> > Then, in the second iteration the following error occurs int the doc 1154
>> > indexing:
>> >
>> > adding docs\1148
>> > adding docs\1149
>> > adding docs\1150
>> > adding docs\1151
>> > adding docs\1152
>> > adding docs\1153
>> > adding docs\1154
>> > java.io.IOException: Cannot overwrite: index\_zk.cfs
>> >    at
>> org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362)
>> >    at
>> >
>> >
>> org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58)
>> >    at
>> >
>> >
>> org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150)
>> >    at
>> >
>> >
>> org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618)
>> >    at
>> >
>> org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320)
>> >    at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174)
>> >    at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165)
>> >    at
>> > org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055)
>> >    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118)
>> >    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096)
>> >
>> > This is the code:
>> >
>> > public void addDocument(Document doc) throws CorruptIndexException,
>> >            IOException {
>> >        synchronized (getIndexWriter()) {
>> >                getIndexWriter().addDocument(doc);
>> >                getIndexWriter().commit();
>> >        }
>> >    }
>> >
>> >
>> > Can any help me?
>> >
>> > Now Thanks!
>> >
>> > --
>> > Fabrício Raphael Silva Ferreira
>> >
>>
>
>
>
> --
> Fabrício Raphael
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


lucene at mikemccandless

Nov 21, 2009, 1:50 AM

Post #5 of 5 (522 views)
Permalink
Re: Help me with this error on indexing [In reply to]

Are you absolutely certain you are closing the IndexReader after each
iteration? That exception looks like there is still a file open...

Committing after every added document is hideously inefficient
(though, should not cause exceptions like what you're seeing). It's
best to commit (or, simply close), at the end, when you're just
building up a new index.

It's also not a good idea to sync(IndexWriter), because that can lead
to deadlock (Lucene syncs on it internally). Further, it's not
necessary since IW can take advantage of concurrency when multiple
threads call addDocument at once.

Mike

On Sat, Nov 21, 2009 at 4:46 AM, Simon Willnauer
<simon.willnauer [at] googlemail> wrote:
> Try to switch you AntiVirus SW off I you have any.
>
> simon
>
> 2009/11/21 Fabrício Raphael <fabriciorsf [at] gmail>:
>> This hapened only on Windows, on Ubuntu it don't happen.
>>
>> And I corrected this problem by removing the commit, and put it in the end
>> of the addition of all documents.
>>
>> On Fri, Nov 20, 2009 at 9:14 PM, Erick Erickson <erickerickson [at] gmail>wrote:
>>
>>> What operating system are you running on? This sounds like Windows behavior
>>> when some other process is holding the file open.....
>>>
>>> Erick
>>>
>>> 2009/11/20 Fabrício Raphael <fabriciorsf [at] gmail>
>>>
>>> > Hi,
>>> >
>>> > I am evaluating several search algoritms, and I iterate on each. In each
>>> > interation I delete the index directory, index the docs and I run the
>>> > evaluation on the algoritm. The end of the iteration I close the
>>> > indexReader.
>>> >
>>> > Then, in the second iteration the following error occurs int the doc 1154
>>> > indexing:
>>> >
>>> > adding docs\1148
>>> > adding docs\1149
>>> > adding docs\1150
>>> > adding docs\1151
>>> > adding docs\1152
>>> > adding docs\1153
>>> > adding docs\1154
>>> > java.io.IOException: Cannot overwrite: index\_zk.cfs
>>> >    at
>>> org.apache.lucene.store.FSDirectory.initOutput(FSDirectory.java:362)
>>> >    at
>>> >
>>> >
>>> org.apache.lucene.store.SimpleFSDirectory.createOutput(SimpleFSDirectory.java:58)
>>> >    at
>>> >
>>> >
>>> org.apache.lucene.index.CompoundFileWriter.close(CompoundFileWriter.java:150)
>>> >    at
>>> >
>>> >
>>> org.apache.lucene.index.DocumentsWriter.createCompoundFile(DocumentsWriter.java:618)
>>> >    at
>>> >
>>> org.apache.lucene.index.IndexWriter.doFlushInternal(IndexWriter.java:4320)
>>> >    at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:4174)
>>> >    at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:4165)
>>> >    at
>>> > org.apache.lucene.index.IndexWriter.prepareCommit(IndexWriter.java:4055)
>>> >    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4118)
>>> >    at org.apache.lucene.index.IndexWriter.commit(IndexWriter.java:4096)
>>> >
>>> > This is the code:
>>> >
>>> > public void addDocument(Document doc) throws CorruptIndexException,
>>> >            IOException {
>>> >        synchronized (getIndexWriter()) {
>>> >                getIndexWriter().addDocument(doc);
>>> >                getIndexWriter().commit();
>>> >        }
>>> >    }
>>> >
>>> >
>>> > Can any help me?
>>> >
>>> > Now Thanks!
>>> >
>>> > --
>>> > Fabrício Raphael Silva Ferreira
>>> >
>>>
>>
>>
>>
>> --
>> Fabrício Raphael
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.