On Tue, Mar 23, 2004 at 08:48:11PM -0600, Chad Small wrote:
> Thanks-you Erik and Incze.  I now understand the issue
> and I'm trying to create a "KeywordAnalyzer" as suggested
> from you book excerpt, Erik:
>  
> http://issues.apache.org/eyebrowse/[EMAIL PROTECTED]&msgNo=6727
>  
> However, not being all that familiar with the Analyzer framework,
> I'm not sure how to implement the "KeywordAnalyzer" even though
> it might be "trivial" :)  Any hints, code, or messages to look at?
>  

Actually, what I've written was not an analyzer, but a NotTokenizingTokenizer,
as I have a very specia analyzer (different needs for different
field catgories) and this is used in that (the code is far from the
phase of any kind of optimization, but you can see the logic):

---
package hu.emnl.lucene.analyzer;

import java.io.IOException;
import java.io.Reader;

import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.Tokenizer;

public class NotTokenizingTokenizer extends Tokenizer {

        public NotTokenizingTokenizer() {
                super();
        }

        public NotTokenizingTokenizer(Reader input) {
                super(input);
        }

        public Token next() throws IOException {
                Token t = null;
                int c = input.read();
                if (c >= 0) {
                        StringBuffer sb = new StringBuffer();  
                        do {
                                sb.append((char) c);
                                c = input.read();
                        } while (c >= 0);
                        t = new Token(new String(sb), 0, sb.length());
                }
                return t;
        }
}
---

incze

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to