hi Robert,

thank you for your replies.

I couldn't find much documentation/examples of this, but this is what I came up with (below). is that the way I'm supposed to use the MappingCharFilter?

also, if that is the correct way, wouldn't it make sense to return a reference to "this" from NormalizeCharMap.Builder.add() so that we can chain the calls to add() like so: builder.add( ",", ", " ).add( ";", "; " ).build() ?

thanks,

Igal


    public class CommaSpaceCharFilter extends MappingCharFilter {

        public CommaSpaceCharFilter( Reader input ) {

            super( getMap(), input );
        }

        final static NormalizeCharMap getMap() {

NormalizeCharMap.Builder builder = new NormalizeCharMap.Builder();

            builder.add( ",", ", " );
            builder.add( ";", "; " );

            NormalizeCharMap ncm = builder.build();

            return ncm;
        }
    }



On 11/3/2012 5:13 PM, Robert Muir wrote:
On Sat, Nov 3, 2012 at 7:47 PM, Igal @ getRailo.org <i...@getrailo.org> wrote:
I considered it, and it's definitely an option.

but I read in the book "Lucene In Action" that MappingCharFilter is
inefficient and I'm not sure that I need that.  if implementing my own
involves a lot of coding then I might resort to it as I don't have large
data sets to index at this time.
Also I think (dont remember off the top of my head) that this note in
Lucene in Action refers to the fact that its base class
(BaseCharFilter) corrected offsets in O(n) at the time.

We fixed this to be O(log(N)) here as of 3.1:
https://issues.apache.org/jira/browse/LUCENE-2098

So I think its worth giving it a try before trying to code something yourself!

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org
For additional commands, e-mail: java-user-h...@lucene.apache.org

Reply via email to