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 Leonardo Foderaro <st...@gmail.com> on 2015/09/09 17:24:30 UTC

Introducing Alba, a small library to simplify Solr plugins development

Hi everyone,

this is my first post on this list and my first opensource project, so
please don't expect too much from either of them.

I've spent these last weeks trying to understand how to create Solr
plugins, so I started a simple project (a plugin itself) which evolved into
a small library named Alba (the Italian word for 'sunrise'), aimed to
simplify their development. To summarize it, each plugin is just an
annotated method:

@AlbaPlugin(name="myPluginsLibrary")
public class MyPlugins {

    @DocTransformer(name="helloworld")
     public void hello(SolrDocument doc) {
         doc.setField("message", "Hello, World!");
     }

    @FunctionQuery(name="len", description="returns the length of a string")
     public Integer len(@Param(name="string", description="the string to
measure") String s) {
        return s.length();
     }

}

and this is how you call it, assuming 'author' is a valid field in your
schema:

fl=[alba name="helloworld"],alba(len,string=author),message

Plugins currently supported are:

- FunctionQuery
- ResponseWriter
- RequestHandler
- SearchComponent
- DocTransformer

Of course it's far from being complete and I still have to learn a lot of
things about Solr (not to mention Java itself!), nontheless working on it
is a terrific learning experience for me, and I think it could evolve into
something useful.

At http://github.com/leonardofoderaro/ you can find the project with a
small tutorial in the wiki and some related repos, e.g. the plugins built
in the tutorial.

I still have many questions about Solr, but first I'd like to ask you if
you think it's a good idea. Any feedback is very welcome.

Kind regards,
Leonardo