You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Sujatha Arun <su...@gmail.com> on 2012/08/13 13:18:51 UTC

Custom Plugins for solr

Hi ,

I would like to write a custom component for solr  to address a particular
issue.

This is what I have been doing ,write the custom code directly in the
downloaded code base and rebuild the war file and deploy the same. We
currently have multiple cores ,hence  I want to approach this in a core
specific way as opposed to affecting all the cores in the webapp .

If I have to write a plugin and move it to the lib directory of each core
,would I just need to add one single class file packed as a jar  and make
appropriate changes to the solrconfig file .When I reload the core , I am
assuming that apart from the  classes in the war file ,this jar file in the
lib will be automatically referenced.

Would I need to restart sevlet container?
Would I need to have other files to which this custom class is referencing
to in the custom jar file or will that be automatically taken care of?

Regards
Sujatha

Re: Custom Plugins for solr

Posted by Michael Della Bitta <mi...@appinions.com>.
Sujatha,

As the API of the classes you're compiling against may have changed
with a different Solr version, it's always a good idea to build
against the new version of Solr, otherwise you might see weird issues
at runtime.

You wouldn't have to do anything special other than to drop your src
file into the new Solr project as you have with this one, recompile,
and rebuild your jar.

Michael Della Bitta

------------------------------------------------
Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
www.appinions.com
Where Influence Isn’t a Game


On Mon, Aug 13, 2012 at 1:11 PM, Sujatha Arun <su...@gmail.com> wrote:
> What I would be doing is this ..
>
> Create a custom class that refer to all  org,apache.* classes (import stt)
> ,the custom file's  location is  independent of the solr core class files.
> compile this separately
> package this as a jar
> move this to lib dir of each solr core
> refer to this in lib directory of solrconfig.xml
> realod the core.
>
> I am assuming that I am not directly handling the solr download src files
> or the war files ,Is this correct?do I have to be concerned with build
> files etc? How then does the approach differ in the later versions?
>
> Regards
> Sujatha
>
>
>
>
>
>
>
>
>
> On Mon, Aug 13, 2012 at 10:30 PM, Michael Della Bitta <
> michael.della.bitta@appinions.com> wrote:
>
>> No, the jar would be exactly the same, with the caveat that you'd have
>> to build against the newer Solr version of course.
>>
>> Michael Della Bitta
>>
>> ------------------------------------------------
>> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> www.appinions.com
>> Where Influence Isn’t a Game
>>
>>
>> On Mon, Aug 13, 2012 at 12:55 PM, Sujatha Arun <su...@gmail.com>
>> wrote:
>> > Thanks ,I am going to try this on solr 1.3 version .Would the approach be
>> > any different for the recent sorl versions?
>> >
>> > Regards
>> > Sujatha
>> >
>> > On Mon, Aug 13, 2012 at 8:53 PM, Michael Della Bitta <
>> > michael.della.bitta@appinions.com> wrote:
>> >
>> >> Then you're on the right track.
>> >>
>> >> 1. You'd either have to restart Tomcat or in the case of Multicore
>> >> setups, reload the core.
>> >> 2. If the jar has dependencies outside of the Solr provided classes,
>> >> you'll have to include those as well. If it only depends on Solr stuff
>> >> or things that are in the servlet container's classpath, you should be
>> >> fine with just the one class.
>> >>
>> >> Michael Della Bitta
>> >>
>> >> ------------------------------------------------
>> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> >> www.appinions.com
>> >> Where Influence Isn’t a Game
>> >>
>> >>
>> >> On Mon, Aug 13, 2012 at 10:36 AM, Sujatha Arun <su...@gmail.com>
>> >> wrote:
>> >> > Adding a new class
>> >> >
>> >> > Regards
>> >> > Sujatha
>> >> >
>> >> > On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
>> >> > michael.della.bitta@appinions.com> wrote:
>> >> >
>> >> >> Michael Della Bitta
>> >> >> Hi Sujatha,
>> >> >>
>> >> >> Are you adding a new class, or modifying one of the provided Solr
>> >> classes?
>> >> >>
>> >> >> Michael
>> >> >>
>> >> >>
>> >> >> ------------------------------------------------
>> >> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> >> >> www.appinions.com
>> >> >> Where Influence Isn’t a Game
>> >> >>
>> >> >>
>> >> >> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com>
>> >> wrote:
>> >> >> > Hi ,
>> >> >> >
>> >> >> > I would like to write a custom component for solr  to address a
>> >> >> particular
>> >> >> > issue.
>> >> >> >
>> >> >> > This is what I have been doing ,write the custom code directly in
>> the
>> >> >> > downloaded code base and rebuild the war file and deploy the same.
>> We
>> >> >> > currently have multiple cores ,hence  I want to approach this in a
>> >> core
>> >> >> > specific way as opposed to affecting all the cores in the webapp .
>> >> >> >
>> >> >> > If I have to write a plugin and move it to the lib directory of
>> each
>> >> core
>> >> >> > ,would I just need to add one single class file packed as a jar
>>  and
>> >> make
>> >> >> > appropriate changes to the solrconfig file .When I reload the core
>> ,
>> >> I am
>> >> >> > assuming that apart from the  classes in the war file ,this jar
>> file
>> >> in
>> >> >> the
>> >> >> > lib will be automatically referenced.
>> >> >> >
>> >> >> > Would I need to restart sevlet container?
>> >> >> > Would I need to have other files to which this custom class is
>> >> >> referencing
>> >> >> > to in the custom jar file or will that be automatically taken care
>> of?
>> >> >> >
>> >> >> > Regards
>> >> >> > Sujatha
>> >> >>
>> >>
>>

Re: Custom Plugins for solr

Posted by Sujatha Arun <su...@gmail.com>.
What I would be doing is this ..

Create a custom class that refer to all  org,apache.* classes (import stt)
,the custom file's  location is  independent of the solr core class files.
compile this separately
package this as a jar
move this to lib dir of each solr core
refer to this in lib directory of solrconfig.xml
realod the core.

I am assuming that I am not directly handling the solr download src files
or the war files ,Is this correct?do I have to be concerned with build
files etc? How then does the approach differ in the later versions?

Regards
Sujatha









On Mon, Aug 13, 2012 at 10:30 PM, Michael Della Bitta <
michael.della.bitta@appinions.com> wrote:

> No, the jar would be exactly the same, with the caveat that you'd have
> to build against the newer Solr version of course.
>
> Michael Della Bitta
>
> ------------------------------------------------
> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> www.appinions.com
> Where Influence Isn’t a Game
>
>
> On Mon, Aug 13, 2012 at 12:55 PM, Sujatha Arun <su...@gmail.com>
> wrote:
> > Thanks ,I am going to try this on solr 1.3 version .Would the approach be
> > any different for the recent sorl versions?
> >
> > Regards
> > Sujatha
> >
> > On Mon, Aug 13, 2012 at 8:53 PM, Michael Della Bitta <
> > michael.della.bitta@appinions.com> wrote:
> >
> >> Then you're on the right track.
> >>
> >> 1. You'd either have to restart Tomcat or in the case of Multicore
> >> setups, reload the core.
> >> 2. If the jar has dependencies outside of the Solr provided classes,
> >> you'll have to include those as well. If it only depends on Solr stuff
> >> or things that are in the servlet container's classpath, you should be
> >> fine with just the one class.
> >>
> >> Michael Della Bitta
> >>
> >> ------------------------------------------------
> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> >> www.appinions.com
> >> Where Influence Isn’t a Game
> >>
> >>
> >> On Mon, Aug 13, 2012 at 10:36 AM, Sujatha Arun <su...@gmail.com>
> >> wrote:
> >> > Adding a new class
> >> >
> >> > Regards
> >> > Sujatha
> >> >
> >> > On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
> >> > michael.della.bitta@appinions.com> wrote:
> >> >
> >> >> Michael Della Bitta
> >> >> Hi Sujatha,
> >> >>
> >> >> Are you adding a new class, or modifying one of the provided Solr
> >> classes?
> >> >>
> >> >> Michael
> >> >>
> >> >>
> >> >> ------------------------------------------------
> >> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> >> >> www.appinions.com
> >> >> Where Influence Isn’t a Game
> >> >>
> >> >>
> >> >> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com>
> >> wrote:
> >> >> > Hi ,
> >> >> >
> >> >> > I would like to write a custom component for solr  to address a
> >> >> particular
> >> >> > issue.
> >> >> >
> >> >> > This is what I have been doing ,write the custom code directly in
> the
> >> >> > downloaded code base and rebuild the war file and deploy the same.
> We
> >> >> > currently have multiple cores ,hence  I want to approach this in a
> >> core
> >> >> > specific way as opposed to affecting all the cores in the webapp .
> >> >> >
> >> >> > If I have to write a plugin and move it to the lib directory of
> each
> >> core
> >> >> > ,would I just need to add one single class file packed as a jar
>  and
> >> make
> >> >> > appropriate changes to the solrconfig file .When I reload the core
> ,
> >> I am
> >> >> > assuming that apart from the  classes in the war file ,this jar
> file
> >> in
> >> >> the
> >> >> > lib will be automatically referenced.
> >> >> >
> >> >> > Would I need to restart sevlet container?
> >> >> > Would I need to have other files to which this custom class is
> >> >> referencing
> >> >> > to in the custom jar file or will that be automatically taken care
> of?
> >> >> >
> >> >> > Regards
> >> >> > Sujatha
> >> >>
> >>
>

Re: Custom Plugins for solr

Posted by Michael Della Bitta <mi...@appinions.com>.
No, the jar would be exactly the same, with the caveat that you'd have
to build against the newer Solr version of course.

Michael Della Bitta

------------------------------------------------
Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
www.appinions.com
Where Influence Isn’t a Game


On Mon, Aug 13, 2012 at 12:55 PM, Sujatha Arun <su...@gmail.com> wrote:
> Thanks ,I am going to try this on solr 1.3 version .Would the approach be
> any different for the recent sorl versions?
>
> Regards
> Sujatha
>
> On Mon, Aug 13, 2012 at 8:53 PM, Michael Della Bitta <
> michael.della.bitta@appinions.com> wrote:
>
>> Then you're on the right track.
>>
>> 1. You'd either have to restart Tomcat or in the case of Multicore
>> setups, reload the core.
>> 2. If the jar has dependencies outside of the Solr provided classes,
>> you'll have to include those as well. If it only depends on Solr stuff
>> or things that are in the servlet container's classpath, you should be
>> fine with just the one class.
>>
>> Michael Della Bitta
>>
>> ------------------------------------------------
>> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> www.appinions.com
>> Where Influence Isn’t a Game
>>
>>
>> On Mon, Aug 13, 2012 at 10:36 AM, Sujatha Arun <su...@gmail.com>
>> wrote:
>> > Adding a new class
>> >
>> > Regards
>> > Sujatha
>> >
>> > On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
>> > michael.della.bitta@appinions.com> wrote:
>> >
>> >> Michael Della Bitta
>> >> Hi Sujatha,
>> >>
>> >> Are you adding a new class, or modifying one of the provided Solr
>> classes?
>> >>
>> >> Michael
>> >>
>> >>
>> >> ------------------------------------------------
>> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> >> www.appinions.com
>> >> Where Influence Isn’t a Game
>> >>
>> >>
>> >> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com>
>> wrote:
>> >> > Hi ,
>> >> >
>> >> > I would like to write a custom component for solr  to address a
>> >> particular
>> >> > issue.
>> >> >
>> >> > This is what I have been doing ,write the custom code directly in the
>> >> > downloaded code base and rebuild the war file and deploy the same. We
>> >> > currently have multiple cores ,hence  I want to approach this in a
>> core
>> >> > specific way as opposed to affecting all the cores in the webapp .
>> >> >
>> >> > If I have to write a plugin and move it to the lib directory of each
>> core
>> >> > ,would I just need to add one single class file packed as a jar  and
>> make
>> >> > appropriate changes to the solrconfig file .When I reload the core ,
>> I am
>> >> > assuming that apart from the  classes in the war file ,this jar file
>> in
>> >> the
>> >> > lib will be automatically referenced.
>> >> >
>> >> > Would I need to restart sevlet container?
>> >> > Would I need to have other files to which this custom class is
>> >> referencing
>> >> > to in the custom jar file or will that be automatically taken care of?
>> >> >
>> >> > Regards
>> >> > Sujatha
>> >>
>>

Re: Custom Plugins for solr

Posted by Sujatha Arun <su...@gmail.com>.
Thanks ,I am going to try this on solr 1.3 version .Would the approach be
any different for the recent sorl versions?

Regards
Sujatha

On Mon, Aug 13, 2012 at 8:53 PM, Michael Della Bitta <
michael.della.bitta@appinions.com> wrote:

> Then you're on the right track.
>
> 1. You'd either have to restart Tomcat or in the case of Multicore
> setups, reload the core.
> 2. If the jar has dependencies outside of the Solr provided classes,
> you'll have to include those as well. If it only depends on Solr stuff
> or things that are in the servlet container's classpath, you should be
> fine with just the one class.
>
> Michael Della Bitta
>
> ------------------------------------------------
> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> www.appinions.com
> Where Influence Isn’t a Game
>
>
> On Mon, Aug 13, 2012 at 10:36 AM, Sujatha Arun <su...@gmail.com>
> wrote:
> > Adding a new class
> >
> > Regards
> > Sujatha
> >
> > On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
> > michael.della.bitta@appinions.com> wrote:
> >
> >> Michael Della Bitta
> >> Hi Sujatha,
> >>
> >> Are you adding a new class, or modifying one of the provided Solr
> classes?
> >>
> >> Michael
> >>
> >>
> >> ------------------------------------------------
> >> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> >> www.appinions.com
> >> Where Influence Isn’t a Game
> >>
> >>
> >> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com>
> wrote:
> >> > Hi ,
> >> >
> >> > I would like to write a custom component for solr  to address a
> >> particular
> >> > issue.
> >> >
> >> > This is what I have been doing ,write the custom code directly in the
> >> > downloaded code base and rebuild the war file and deploy the same. We
> >> > currently have multiple cores ,hence  I want to approach this in a
> core
> >> > specific way as opposed to affecting all the cores in the webapp .
> >> >
> >> > If I have to write a plugin and move it to the lib directory of each
> core
> >> > ,would I just need to add one single class file packed as a jar  and
> make
> >> > appropriate changes to the solrconfig file .When I reload the core ,
> I am
> >> > assuming that apart from the  classes in the war file ,this jar file
> in
> >> the
> >> > lib will be automatically referenced.
> >> >
> >> > Would I need to restart sevlet container?
> >> > Would I need to have other files to which this custom class is
> >> referencing
> >> > to in the custom jar file or will that be automatically taken care of?
> >> >
> >> > Regards
> >> > Sujatha
> >>
>

Re: Custom Plugins for solr

Posted by Michael Della Bitta <mi...@appinions.com>.
Then you're on the right track.

1. You'd either have to restart Tomcat or in the case of Multicore
setups, reload the core.
2. If the jar has dependencies outside of the Solr provided classes,
you'll have to include those as well. If it only depends on Solr stuff
or things that are in the servlet container's classpath, you should be
fine with just the one class.

Michael Della Bitta

------------------------------------------------
Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
www.appinions.com
Where Influence Isn’t a Game


On Mon, Aug 13, 2012 at 10:36 AM, Sujatha Arun <su...@gmail.com> wrote:
> Adding a new class
>
> Regards
> Sujatha
>
> On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
> michael.della.bitta@appinions.com> wrote:
>
>> Michael Della Bitta
>> Hi Sujatha,
>>
>> Are you adding a new class, or modifying one of the provided Solr classes?
>>
>> Michael
>>
>>
>> ------------------------------------------------
>> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
>> www.appinions.com
>> Where Influence Isn’t a Game
>>
>>
>> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com> wrote:
>> > Hi ,
>> >
>> > I would like to write a custom component for solr  to address a
>> particular
>> > issue.
>> >
>> > This is what I have been doing ,write the custom code directly in the
>> > downloaded code base and rebuild the war file and deploy the same. We
>> > currently have multiple cores ,hence  I want to approach this in a core
>> > specific way as opposed to affecting all the cores in the webapp .
>> >
>> > If I have to write a plugin and move it to the lib directory of each core
>> > ,would I just need to add one single class file packed as a jar  and make
>> > appropriate changes to the solrconfig file .When I reload the core , I am
>> > assuming that apart from the  classes in the war file ,this jar file in
>> the
>> > lib will be automatically referenced.
>> >
>> > Would I need to restart sevlet container?
>> > Would I need to have other files to which this custom class is
>> referencing
>> > to in the custom jar file or will that be automatically taken care of?
>> >
>> > Regards
>> > Sujatha
>>

Re: Custom Plugins for solr

Posted by Sujatha Arun <su...@gmail.com>.
Adding a new class

Regards
Sujatha

On Mon, Aug 13, 2012 at 5:54 PM, Michael Della Bitta <
michael.della.bitta@appinions.com> wrote:

> Michael Della Bitta
> Hi Sujatha,
>
> Are you adding a new class, or modifying one of the provided Solr classes?
>
> Michael
>
>
> ------------------------------------------------
> Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
> www.appinions.com
> Where Influence Isn’t a Game
>
>
> On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com> wrote:
> > Hi ,
> >
> > I would like to write a custom component for solr  to address a
> particular
> > issue.
> >
> > This is what I have been doing ,write the custom code directly in the
> > downloaded code base and rebuild the war file and deploy the same. We
> > currently have multiple cores ,hence  I want to approach this in a core
> > specific way as opposed to affecting all the cores in the webapp .
> >
> > If I have to write a plugin and move it to the lib directory of each core
> > ,would I just need to add one single class file packed as a jar  and make
> > appropriate changes to the solrconfig file .When I reload the core , I am
> > assuming that apart from the  classes in the war file ,this jar file in
> the
> > lib will be automatically referenced.
> >
> > Would I need to restart sevlet container?
> > Would I need to have other files to which this custom class is
> referencing
> > to in the custom jar file or will that be automatically taken care of?
> >
> > Regards
> > Sujatha
>

Re: Custom Plugins for solr

Posted by Michael Della Bitta <mi...@appinions.com>.
Michael Della Bitta
Hi Sujatha,

Are you adding a new class, or modifying one of the provided Solr classes?

Michael


------------------------------------------------
Appinions | 18 East 41st St., Suite 1806 | New York, NY 10017
www.appinions.com
Where Influence Isn’t a Game


On Mon, Aug 13, 2012 at 7:18 AM, Sujatha Arun <su...@gmail.com> wrote:
> Hi ,
>
> I would like to write a custom component for solr  to address a particular
> issue.
>
> This is what I have been doing ,write the custom code directly in the
> downloaded code base and rebuild the war file and deploy the same. We
> currently have multiple cores ,hence  I want to approach this in a core
> specific way as opposed to affecting all the cores in the webapp .
>
> If I have to write a plugin and move it to the lib directory of each core
> ,would I just need to add one single class file packed as a jar  and make
> appropriate changes to the solrconfig file .When I reload the core , I am
> assuming that apart from the  classes in the war file ,this jar file in the
> lib will be automatically referenced.
>
> Would I need to restart sevlet container?
> Would I need to have other files to which this custom class is referencing
> to in the custom jar file or will that be automatically taken care of?
>
> Regards
> Sujatha