You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by aravinth thangasami <ar...@gmail.com> on 2016/08/04 06:22:37 UTC

Why we need org.apache.lucene.codecs.Codec

Hi all,

Re: Why we need org.apache.lucene.codecs.Codec

Posted by Greg Bowyer <gb...@fastmail.co.uk>.
Not quite sure what you mean, lucene needs some way to load a codec, and
give parts of an index written with different codecs it would need
tonload and select the right code at the right time.

Consider, for example the upgrade path. Let's say you have segments
written with code 5.x and we in place upgrade to 6.x, lucene is going to
need to know how to load up the codec for 5.x and 6.x.

On Thu, Aug 4, 2016, at 09:03 AM, Aravinth T wrote:
> I understand that, my question is different why we are loading it with
> SPI,
> 
> why we explicitly controlling the loading of Codecs 
> 
> 
> 
> 
> ---- On Thu, 04 Aug 2016 20:39:46 +0530 Greg Bowyer
> &lt;gbowyer@fastmail.co.uk&gt;wrote ---- 
> 
> 
> 
> 
> Codecs are loaded with the java service loader interface. That file is 
> 
> the hook used to tell the service loader that this jar implements Codec. 
> 
>  
> 
> Lucene internally calls service loader and asks what codecs are there. 
> 
>  
> 
> On Wed, Aug 3, 2016, at 11:23 PM, aravinth thangasami wrote: 
> 
> &gt; I don't understand why we need to add custom codec name in this file 
> 
> &gt; 
> 
> &gt; Thanks &amp; Regards 
> 
> &gt; Aravinth 
> 
> &gt; 
> 
> &gt; On Thu, Aug 4, 2016 at 11:52 AM, aravinth thangasami &lt; 
> 
> &gt; aravinththangasami@gmail.com&gt; wrote: 
> 
> &gt; 
> 
> &gt; &gt; Hi all, 
> 
> &gt; &gt; 
> 
> &gt; &gt; 
> 
>  
> 
> --------------------------------------------------------------------- 
> 
> 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


Re: Why we need org.apache.lucene.codecs.Codec

Posted by Aravinth T <ar...@zohocorp.com>.
I understand that, my question is different why we are loading it with SPI,

why we explicitly controlling the loading of Codecs 




---- On Thu, 04 Aug 2016 20:39:46 +0530 Greg Bowyer &lt;gbowyer@fastmail.co.uk&gt;wrote ---- 




Codecs are loaded with the java service loader interface. That file is 

the hook used to tell the service loader that this jar implements Codec. 

 

Lucene internally calls service loader and asks what codecs are there. 

 

On Wed, Aug 3, 2016, at 11:23 PM, aravinth thangasami wrote: 

&gt; I don't understand why we need to add custom codec name in this file 

&gt; 

&gt; Thanks &amp; Regards 

&gt; Aravinth 

&gt; 

&gt; On Thu, Aug 4, 2016 at 11:52 AM, aravinth thangasami &lt; 

&gt; aravinththangasami@gmail.com&gt; wrote: 

&gt; 

&gt; &gt; Hi all, 

&gt; &gt; 

&gt; &gt; 

 

--------------------------------------------------------------------- 

To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org 

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

 







Re: Why we need org.apache.lucene.codecs.Codec

Posted by Uwe Schindler <uw...@thetaphi.de>.
Hi,

The Codec class is the abstract base class for all index codecs. The implementation is loaded via SPI from classpath. To understand how this works read API doc's of Java ServiceLoader which describes the process.

Uwe

Am 4. August 2016 17:09:46 MESZ, schrieb Greg Bowyer <gb...@fastmail.co.uk>:
>Codecs are loaded with the java service loader interface. That file is
>the hook used to tell the service loader that this jar implements
>Codec.
>
>Lucene internally calls service loader and asks what codecs are there.
>
>On Wed, Aug 3, 2016, at 11:23 PM, aravinth thangasami wrote:
>> I don't understand why we need to add custom codec name in this file
>> 
>> Thanks & Regards
>> Aravinth
>> 
>> On Thu, Aug 4, 2016 at 11:52 AM, aravinth thangasami <
>> aravinththangasami@gmail.com> wrote:
>> 
>> > Hi all,
>> >
>> >
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org

--
Uwe Schindler
H.-H.-Meier-Allee 63, 28213 Bremen
http://www.thetaphi.de

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


Re: Why we need org.apache.lucene.codecs.Codec

Posted by Greg Bowyer <gb...@fastmail.co.uk>.
Codecs are loaded with the java service loader interface. That file is
the hook used to tell the service loader that this jar implements Codec.

Lucene internally calls service loader and asks what codecs are there.

On Wed, Aug 3, 2016, at 11:23 PM, aravinth thangasami wrote:
> I don't understand why we need to add custom codec name in this file
> 
> Thanks & Regards
> Aravinth
> 
> On Thu, Aug 4, 2016 at 11:52 AM, aravinth thangasami <
> aravinththangasami@gmail.com> wrote:
> 
> > Hi all,
> >
> >

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


Re: Why we need org.apache.lucene.codecs.Codec

Posted by aravinth thangasami <ar...@gmail.com>.
I don't understand why we need to add custom codec name in this file

Thanks & Regards
Aravinth

On Thu, Aug 4, 2016 at 11:52 AM, aravinth thangasami <
aravinththangasami@gmail.com> wrote:

> Hi all,
>
>