Hi

Well, creating a Factory for each new Tokenizer we want to add means you are
replicating the same code again and again just to bind the Factory (Solr
interface) to the Tokenizer (Lucene interface).

Why instead of that we don't create an UbberFactory that takes the Tokenizer
class as a parameter and instantiates the proper Tokenizer?

It could be done simply, but it would impact the schema.xml and its parsers
and config classes associated. But I think it would make things simpler.

What do you think about it?

A code example follows:
public class UbberTokenizerFactory extends BaseTokenizerFactory {    /**
* @see org.apache.solr.analysis.TokenizerFactory#create(Reader)     */
public TokenStream create(Reader input)    {        String
tokenizerClassName = ""; // get the tokenizer class name from the config
try        {            return
(TokenStream)(Class.forName(tokenizerClassName).getConstructor(new
Class[]{Reader.class}).newInstance(input));        }        catch (Exception
e)        {            throw new IllegalArgumentException("It wasn't
possible to instantiate the Factory. Verify if the tokenizer class name \""
+ tokenizerClassName + "\" is correct and is available in the classpath.",
e);        }        //return new CJKTokenizer(input);    } }

Regards,
Daniel Alheiros

On 19/6/07 18:57, "Mike Klaas" <[EMAIL PROTECTED]> wrote:

> 
> On 18-Jun-07, at 10:28 PM, Toru Matsuzawa wrote:
> 
>> I'm sorry. Because it was not possible to append it,
>> it sends it again.
>> 
>>>> I got the error below after adding CJKTokenizer to schema.xml.  I
>>>> checked the constructor of CJKTokenizer, it requires a Reader
>>>> parameter,
>>>> I guess that's why I get this error, I searched the email
>>>> archive, it
>>>> seems working for other users. Does anyone know what is the problem?
>>> 
>>> 
>>> CJKTokenizerFactory that I am using is appended.
> 
> Would you be interested in contributing this class to solr?
> 
> -MIke


http://www.bbc.co.uk/
This e-mail (and any attachments) is confidential and may contain personal 
views which are not the views of the BBC unless specifically stated.
If you have received it in error, please delete it from your system.
Do not use, copy or disclose the information in any way nor act in reliance on 
it and notify the sender immediately.
Please note that the BBC monitors e-mails sent or received.
Further communication will signify your consent to this.
                                        

Reply via email to