Lucene making reference to a .jar -- How do I this code?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Lucene making reference to a .jar -- How do I this code?

jellyman
Hi,

        I have the Lucene source code successfully building inside Eclipse (using ant & ivy). I wish to make a contribution to the lucene project and using the principle of "follow the existing pattern" I need to put the source code into the "commons-codec-1.6.jar" area.
        Now obviously, this is not possible so I need to get the source code for this component. My first question is where do I get this?

        My second question after I have added the source code ie the .java file contain the new functionality do I do a Source Attachment Configuration and point it to the location of this java file from the main lucene project?

        Should I create another project next to the lucene project called something like: "commons-codec" or something like that.

        Can anyone recommend the best practise as to what to do when I need to add something to Lucene that is inside another jar? Would appreciate a little handholding on this one as I'm still a bit of a newbie.

Thanks a mill,
jellyman
Reply | Threaded
Open this post in threaded view
|

Re: Lucene making reference to a .jar -- How do I this code?

Ted Dunning
Maybe you want to look this project?

     http://commons.apache.org/codec/

But do you really need to change commons codec?  You don't really describe
what you are doing and changing a pre-built package is a very rare
requirement for working with Lucene.  Can you describe what you want to do
more specifically?

Also, you will generally have better results if you subscribe directly to
the mailing list rather than use a proxy interface like nabble.

On Thu, Aug 16, 2012 at 3:58 AM, jellyman <[hidden email]> wrote:

> Hi,
>
>         I have the Lucene source code successfully building inside Eclipse
> (using
> ant & ivy). I wish to make a contribution to the lucene project and using
> the principle of "follow the existing pattern" I need to put the source
> code
> into the "commons-codec-1.6.jar" area.
>         Now obviously, this is not possible so I need to get the source
> code for
> this component. My first question is where do I get this?
>
>         My second question after I have added the source code ie the .java
> file
> contain the new functionality do I do a Source Attachment Configuration and
> point it to the location of this java file from the main lucene project?
>
>         Should I create another project next to the lucene project called
> something
> like: "commons-codec" or something like that.
>
>         Can anyone recommend the best practise as to what to do when I
> need to add
> something to Lucene that is inside another jar? Would appreciate a little
> handholding on this one as I'm still a bit of a newbie.
>
> Thanks a mill,
> jellyman
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Lucene-making-reference-to-a-jar-How-do-I-this-code-tp4001597.html
> Sent from the Lucene - General mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|

Re: Lucene making reference to a .jar -- How do I this code?

jellyman
Hi Ted,


   Thanks for the URL. To answer your question: I'm adding another phoenetic algorithm to the org.apache.commons.codec.language package (as the rest of them live there) and then hardwire it into the lucene/analysis/phoenetic/src/java path like the existing phoenetic filters that exist there already. Following existing pattern essentially.
   I'm assuming that you have to edit this pre-built package or am I missing something? I think that I am...

Any advice/guidance much appreciated,
jellyman.
Reply | Threaded
Open this post in threaded view
|

Re: Lucene making reference to a .jar -- How do I this code?

Robert Muir
On Thu, Aug 16, 2012 at 10:56 AM, jellyman <[hidden email]> wrote:

> Hi Ted,
>
>
>    Thanks for the URL. To answer your question: I'm adding another phoenetic
> algorithm to the org.apache.commons.codec.language package (as the rest of
> them live there) and then hardwire it into the
> lucene/analysis/phoenetic/src/java path like the existing phoenetic filters
> that exist there already. Following existing pattern essentially.
>    I'm assuming that you have to edit this pre-built package or am I missing
> something? I think that I am...
>

You don't need to actually modify commons-codec to do that, you can
just write your own phonetic encoder, extending
org.apache.commons.codec.Encoder, and pass that to PhoneticFilter.

--
lucidworks.com
Reply | Threaded
Open this post in threaded view
|

Re: Lucene making reference to a .jar -- How do I this code?

jellyman
Ted,

     Thanks a million, that's great. Just what I needed a bit of guidance. I'm going to ask a silly question now but lets say I have a new java class called "NewPhoenetic.java" that as you indicated entends org.apache.commons.codec.Encoder, my question is where should I put this file? - would it be into the
lucene/analysis/phoenetic/src/java fiolder beside all the other phoenetic filter classes?

Thanks,
jellyman
Reply | Threaded
Open this post in threaded view
|

Re: Lucene making reference to a .jar -- How do I this code?

jellyman
Hi Ted,

I cannot extend this interface so I guess to you have to use "implements". I do something like:


public class NewPhoeneticAlgo implements org.apache.commons.codec.Encoder
{

    public static String GetPhoneticCode(String name)
    {
        //...etc...  

    }

    @Override
    public Object encode(Object arg0) throws EncoderException {
      return null;

}

   That's about as far as I get. I need some guidance here as to how to do this properly and then pass it to PhoneticFilter and call the unit tests properly from inside lucene/analysis/phonetic/src/test

Any assistance much appreciated,
jellyman.