At first I thought you were referring to Filters in Lucene at query time
(i.e. bitset filters) but I think you are referring to token filters at
indexing/text analysis time?

I have had success writing my own Filter as the link presents. The key is
that you should write a custom class that extends TokenFilter (
http://lucene.apache.org/core/4_1_0/core/org/apache/lucene/analysis/TokenFilter.html)
and write the implementation in your incrementToken() method.

My recollection of this is that instead of returning something of a Token
like you would have in earlier versions of Lucene, you set attribute values
on a notional "current" token. One obvious attribute is the term text
itself and perhaps any positional information. The best place to start is
to pick a fairly simple example from the Solr Source (maybe
lowercasefilter) and try and mimic that.

Cheers!
Amit


On Mon, May 13, 2013 at 1:33 PM, Jonathan Rochkind <rochk...@jhu.edu> wrote:

> Does anyone know of any tutorials, basic examples, and/or documentation on
> writing your own Filter plugin for Solr? For Solr 4.x/4.3?
>
> I would like a Solr 4.3 version of the normalization filters found here
> for Solr 1.4: 
> https://github.com/billdueber/**lib.umich.edu-solr-stuff<https://github.com/billdueber/lib.umich.edu-solr-stuff>
>
> But those are old, for Solr 1.4.
>
> Does anyone have any hints for writing a simple substitution Filter for
> Solr 4.x?  Or, does a simple sourcecode example exist anywhere?
>

Reply via email to