lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Miller <markrmil...@gmail.com>
Subject Re: Calling indexWriter.close() in web app
Date Thu, 12 Jul 2007 10:32:45 GMT
Sorry I was not clear on this. I just meant that you will not have any 
trouble opening a Reader on an index with a lock file. You may have 
trouble deleting with that Reader <g>

When you are using a Reader as a "Writing Reader" i.e. deleting, then 
you pretty much have to consider it as a Writer. I find it very 
convenient to separate my Readers from my Writing Readers. In fact, now 
that Writers can delete (by buffering and using an in internal Reader), 
I only use Readers for read-only operations. Either way, it makes sense 
to draw a separation between Reading Readers and Writing Readers. If 
your going to delete with a Reader, you might as well just consider it a 
Writer as you will have to coordinate it as such. I prefer the Writer 
delete approach as you don't have to close and then reopen the writer.

- Mark

Ard Schrijvers wrote:
> Hello,
>   
>> The lock file is only for Writers. The lock file ensures that 
>> even two 
>> writers from two JVM's will not step on each other. Readers 
>> do not care 
>> about what the writers are doing or whether there is a lock 
>> file...
>>     
>
> Is this always true? The deleteDocuments method of the IndexReader will throw a LockObtainFailedException
when another writer has the index open. 
>
> It might be confusing that from a reader you can delete documents. IIRC, the thing above
will only hold when you only use a reader for reading.
>
> Regards Ard
>
>   
>> even 
>> more so with the new generational files i believe.
>>
>> - Mark
>>
>> vcampa wrote:
>>     
>>> Steinert, Fabian wrote:
>>>   
>>>       
>>>> Hi,
>>>> you do not need to writer.close() the IndexWriter at all 
>>>>         
>> to make changes
>>     
>>>> visible.
>>>> When IndexWriter is constructed with autoCommit = true flag set,
>>>> calling writer.flush() will do.
>>>>
>>>>     
>>>>         
>>> Ok, but what about the write.lock? IndexWriter releases its 
>>>       
>> write.lock only
>>     
>>> when closed, so i think problems may begin when i try to 
>>>       
>> open IndexReader on
>>     
>>> a locked index. I'm still confused... help.
>>>
>>>   
>>>       
>> ---------------------------------------------------------------------
>> 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
>
>
>   

---------------------------------------------------------------------
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