lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: java.io.Ioexception cannot overwrite fdt
Date Tue, 24 Jun 2008 15:45:29 GMT

Are you by any chance, separately, removing files from your index  
directory manually?  That's the one case I know of which can lead to  
that exception, if you also have an IndexReader open on the directory  
at that time.

The code below has one problem.  In your if statement true & false  
clauses, you declare "IndexWriter writer = ...", but, this means you  
cannot use the "writer" variable outside of those scopes.  So I don't  
see how that code can work.

Mike

Sebastin wrote:

>
> Hi,
>
> I am using Lucene to index text based files :
>                          File file = new File("C:/index");
>                          if(file.exists() == false{
>                          IndexWriter writer = new IndexWriter(file,new
> StandardAnalyzer(),true);
>                            }
>                          else
> {
> IndexWriter writer = new IndexWriter(file,new  
> StandardAnalyzer(),false);
> }
>                           FileReader fr = new FileReader("C:/source");
>                           BufferedReader br = new BufferedReader (fr);
>                           String records = br.readline();
>
>                           while (records != null)
>                           {
>
>                    Document doc = new Document();
>                    doc.add(new Field("indexRecords",
> indexRecords,Field.Store.NO, Field.Index.TOKENIZED));
>                    doc.add(new Field("storeRecords",
> storeRecords,Field.Store.YES, Field.Index.NO));
>                    writer.addDocument(doc);
>
>
>
>                    records = br.readLine();
>                    if(records == null)
>                    {
>                    writer.close();
>                    }
>
> }
>
> it throws the following error
>
> java.io.IOException: Cannot overwrite: C:/index/_r.fdt
> 	at  
> org.apache.lucene.store.FSDirectory.createOutput(FSDirectory.java:433)
> 	at org.apache.lucene.index.FieldsWriter.<init>(FieldsWriter.java:47)
> 	at
> org.apache.lucene.index.DocumentsWriter 
> $ThreadState.init(DocumentsWriter.java:865)
> 	at
> org 
> .apache 
> .lucene.index.DocumentsWriter.getThreadState(DocumentsWriter.java: 
> 2391)
> 	at
> org 
> .apache 
> .lucene.index.DocumentsWriter.updateDocument(DocumentsWriter.java: 
> 2434)
> 	at
> org 
> .apache 
> .lucene.index.DocumentsWriter.addDocument(DocumentsWriter.java:2422)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java: 
> 1445)
> 	at org.apache.lucene.index.IndexWriter.addDocument(IndexWriter.java: 
> 1424)
>
>
>
>
>
> Michael McCandless-2 wrote:
>>
>>
>> Can you describe how you are using Lucene, and provide a full  
>> traceback?
>>
>> Mike
>>
>> Sebastin wrote:
>>
>>>
>>> Hi All,
>>>
>>> I am facing this error while doing Indexing text files.can anyone
>>> guide me
>>> how to resolve this issue.
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/java.io.Ioexception-cannot-overwrite-fdt-tp18079321p18079321.html
>>> Sent from the Lucene - Java Users mailing list archive at  
>>> Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/java.io.Ioexception-cannot-overwrite-fdt-tp18079321p18080669.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message