How to create solr custom filter

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

How to create solr custom filter

Mugeesh Husain
Hi,

I am looking for how to create custom filter or tokenizer, I check this blog http://solr.pl/en/2012/05/14/developing-your-own-solr-filter/ but they have not  described how to setup your IDE, how to compile your code or add libs etc.  I don't know how to compile code after fallowing above article, This is very old blog for solr3 version.

Please give me suggestion where i should be starting for writing filter, how to compile or share any suitable article if exist in web.

 
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Alessandro Benedetti
Generally speaking I assume you want to write a Solr plugin [1] ( or you are forking Solr instead?)
So you need to package your jar.
You can setup your IDE as you usually do, and use a building framework such as Maven/Gradle.
After you have your jar you can easily import it in Solr, specifying the location in the solrconfig.xml.



[1] https://wiki.apache.org/solr/SolrPlugins, http://shulhi.com/creating-solr-plugin/
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Andrea Gazzarini-5
On top of what Alessandro already told you, here's a brief post [1] that
can be useful for setting up your dev environment.

HTH
Andrea

[1]
http://andreagazzarini.blogspot.it/2016/11/quickly-debug-your-solr-add-on.html 


On 30/01/17 11:16, alessandro.benedetti wrote:

> Generally speaking I assume you want to write a Solr plugin [1] ( or you are
> forking Solr instead?)
> So you need to package your jar.
> You can setup your IDE as you usually do, and use a building framework such
> as Maven/Gradle.
> After you have your jar you can easily import it in Solr, specifying the
> location in the solrconfig.xml.
>
>
>
> [1] https://wiki.apache.org/solr/SolrPlugins,
> http://shulhi.com/creating-solr-plugin/
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-create-solr-custom-filter-tp4317767p4317784.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Mugeesh Husain
In reply to this post by Alessandro Benedetti
Thank you so much Alessandro Benedetti, it really help me, that the things which i was looking for, one more thing I need to know, how to compile the class file without have main method.
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Alessandro Benedetti
Hi Mugeesh,
 you don't really need the main method in any java class as a requirement for compilation !
Just take a look to building systems such as gradle[1] and maven[2].

Cheers

[1] https://gradle.org
[2]https://maven.apache.org
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Mugeesh Husain
thank you Alessandro and Andrea for your help!
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Alexandre Rafalovitch
There is also Alba to help writing plugins:
https://github.com/leonardofoderaro/alba

Regards,
    Alex.
----
http://www.solr-start.com/ - Resources for Solr users, new and experienced


On 31 January 2017 at 00:10, Mugeesh Husain <[hidden email]> wrote:
> thank you Alessandro and Andrea for your help!
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-create-solr-custom-filter-tp4317767p4317928.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Mugeesh Husain
In reply to this post by Andrea Gazzarini-5
thanks andrea for your help, I created few solr plugin that working fine, but still i am stuck to debug the code using eclipse, as you mentioned below url. http://andreagazzarini.blogspot.in/2016/11/quickly-debug-your-solr-add-on.html In this url, i could not run the junit code, i couldn't run StartDevSolr file(its dosn't showing me junit run/debug), when I removed abstract method from StartDevSolr class the it showing me below error, Assertions mismatch: -ea was not specified but -Dtests.asserts=true Feb 08, 2017 10:30:29 AM com.carrotsearch.randomizedtesting.RandomizedRunner runSuite SEVERE: Panic: RunListener hook shouldn't throw exceptions. java.lang.NullPointerException at org.apache.lucene.util.RunListenerPrintReproduceInfo.printDebuggingInformation(RunListenerPrintReproduceInfo.java:131) at org.apache.lucene.util.RunListenerPrintReproduceInfo.testRunFinished(RunListenerPrintReproduceInfo.java:118) at com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:706) at com.carrotsearch.randomizedtesting.RandomizedRunner.access$200(RandomizedRunner.java:140) at com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:591) I tried above code using solr 6.2.0. I am newone for jnuit may be i am getting this issue, if you have any more debug url, let me know. or suggest me?
Reply | Threaded
Open this post in threaded view
|

Re: How to create solr custom filter

Andrea Gazzarini-5
Hi Mugeesh,
my fault: a point is missing there, as suggested

/"//*-ea *//was not specified but ...."/

//

You need to add the "-ea" VM argument. If you are in Eclipse,

/Run >> Run Configurations/

then in the dialog that appears, select the run configuration
corresponding to that class (StartDevSolr), and click on the second tab
("Arguments"). There you will find two text areas, type *-ea* in the "VM
Arguments" textarea.

HTH
Andrea

On 08/02/17 06:09, Mugeesh Husain wrote:

> thanks andrea for your help, I created few solr plugin that working fine, but
> still i am stuck to debug the code using eclipse, as you mentioned below
> url.http://andreagazzarini.blogspot.in/2016/11/quickly-debug-your-solr-add-on.htmlIn
> this url, i could not run the junit code, i couldn't run StartDevSolr
> file(its dosn't showing me junit run/debug), when I  removed abstract method
> from StartDevSolr class the  it showing me below error,  Assertions
> mismatch: -ea was not specified but -Dtests.asserts=trueFeb 08, 2017
> 10:30:29 AM com.carrotsearch.randomizedtesting.RandomizedRunner
> runSuiteSEVERE: Panic: RunListener hook shouldn't throw
> exceptions.java.lang.NullPointerException at
> org.apache.lucene.util.RunListenerPrintReproduceInfo.printDebuggingInformation(RunListenerPrintReproduceInfo.java:131)
> at
> org.apache.lucene.util.RunListenerPrintReproduceInfo.testRunFinished(RunListenerPrintReproduceInfo.java:118)
> at
> com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:706)
> at
> com.carrotsearch.randomizedtesting.RandomizedRunner.access$200(RandomizedRunner.java:140)
> at
> com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:591)I
> tried above code using solr 6.2.0.I am newone for jnuit may be i am getting
> this issue, if you have any more debug url, let me know.or  suggest me?
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/How-to-create-solr-custom-filter-tp4317767p4319258.html
> Sent from the Solr - User mailing list archive at Nabble.com.