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: Open IndexReader read-only
Date Mon, 08 Dec 2008 13:52:44 GMT
Look for the static factory methods on IndexReader.

- Mark

Chris Bamford wrote:
> Thanks Mark.
>
> I have identified the spot where I need to do the surgery.  However, I 
> discover that IndexReader is abstract, but it seems crazy that I need 
> to make a concrete class for which I have no need to add any of my own 
> logic...  Is there a suitable subclass I can use?  The documented ones 
> - FilterIndexReader, InstantiatedIndexReader, MultiReader, 
> ParallelReader - all seem too complicated for what I need.  My only 
> requirement is to open it read-only!
>
> Am I missing something?
>
> Mark Miller wrote:
>> Chris Bamford wrote:
>>>
>>> So does that mean if you don't explicitly open an IndexReader, the 
>>> IndexSearcher will do it for you?  Or what?
>>>
>> Right. The IndexReader takes a Directory, and the IndexSearcher takes 
>> an IndexReader - there are sugar constructors though - An 
>> IndexSearcher will also accept a String file path, which will be used 
>> to create a Directory which is used to create an IndexReader. It will 
>> also take a Directory, which will be used to create an IndexReader. 
>> It will also just accept the IndexReader.
>>
>> So you have to find how that IndexReader is being created (or where) 
>> and change the code so that you get to create it, and when you do, do 
>> it read-only. It should be easier than that roundabout info sounds.
>>
>> - Mark
>>
>> ---------------------------------------------------------------------
>> 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